Skip to content

Commit

Permalink
Merge branch 'manawiki:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pogseal authored Oct 23, 2024
2 parents e60b0cc + 45aafce commit 6188218
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 111 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ STRIPE_PUBLIC_KEY=
STRIPE_SECRET_KEY=
NODEMAILER_PASSWORD=
FLY_API_TOKEN=
MANA_APP_KEY=
MANA_APP_KEY= #For inngest
INNGEST_SIGNING_KEY=
GA_CLIENT_EMAIL= #analytics service account email
GA_PRIVATE_KEY= #analytics private key
Expand All @@ -21,5 +21,6 @@ TYPESENSE_PRIVATE_KEY=
#CUSTOM SITE VARIABLES - Required if using custom site
CUSTOM_DB_NAME=For single cluster setup
CUSTOM_DB_URI=For external db setup
CUSTOM_DB_APP_KEY=
SITE_ID=
FILE_PREFIX=
10 changes: 9 additions & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Outlet,
Scripts,
useLoaderData,
useLocation,
useNavigation,
} from "@remix-run/react";
import splideCSS from "@splidejs/splide/dist/css/splide-core.min.css";
Expand Down Expand Up @@ -90,6 +91,7 @@ export const loader = async ({
user,
siteSlug,
following,
origin: new URL(request.url).origin,
},
{ headers },
);
Expand Down Expand Up @@ -182,10 +184,11 @@ function ProgressBar() {
}

function App() {
const { locale, toast } = useLoaderData<typeof loader>();
const { locale, toast, origin } = useLoaderData<typeof loader>();
const { i18n } = useTranslation();
const isBot = useIsBot();
const theme = useTheme();
const location = useLocation();

useChangeLanguage(locale);
const { site } = useSiteLoaderData();
Expand Down Expand Up @@ -256,6 +259,11 @@ function App() {
href="/favicon.ico"
/>
)}
<link
//drop search query for canonical url so google won't get confused
rel="canonical"
href={origin + location.pathname}
/>
<Meta />
<Links />
</head>
Expand Down
1 change: 0 additions & 1 deletion app/routes/_home+/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export default function IndexMain() {
return (
<>
<TopHome />
<Discover />
<GetStartedOptions />
<ToolKit />
</>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_home+/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Header() {
"z-50 w-full absolute",
)}
>
<div className="mx-auto max-w-5xl p-4 flex items-center justify-between w-full">
<div className="mx-auto max-w-6xl p-4 flex items-center justify-between w-full">
<Link className="block text-white" to="/" aria-label="Mana Wiki">
<LogoFull />
</Link>
Expand Down
11 changes: 7 additions & 4 deletions app/routes/_home+/components/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ export function Discover() {
return (
<>
<section className="relative z-10 h-full flex-grow">
<div className="border-zinc-300/80 dark:border-zinc-600/50 border-t-2 px-4 relative">
<div className="border-zinc-300/80 dark:border-zinc-600/50 border-t-2 px-4 py-20 relative">
<div className="relative z-20">
<main className="mx-auto max-w-2xl">
<div className="pb-7 font-header text-2xl text-center">
Find your wiki
</div>
<div className="flex items-center justify-center">
<div
className="bg-white dark:shadow-zinc-800/50 dark:border-zinc-600/50 relative -mt-7 dark:bg-dark350
className="bg-white dark:shadow-zinc-800/50 dark:border-zinc-600/50 relative dark:bg-dark350
h-12 w-full rounded-xl border-2 border-zinc-300/80 drop-shadow-sm dark:focus-within:border-zinc-600
focus-within:border-zinc-300"
>
Expand Down Expand Up @@ -79,7 +82,7 @@ export function Discover() {
</>
</div>
</div>
<div className="flex items-center justify-between gap-4 pb-4 pt-6">
<div className="flex items-center justify-between gap-4 py-3">
<RadioGroup
className="flex items-center gap-3"
value={category}
Expand Down Expand Up @@ -161,7 +164,7 @@ export function Discover() {
</RadioGroup>
</div>
</main>
<div className="relative z-20 grid mobile:grid-cols-1 tablet:grid-cols-3 laptop:grid-cols-4 gap-4 mx-auto max-w-7xl">
<div className="relative z-20 grid mobile:grid-cols-1 tablet:grid-cols-3 laptop:grid-cols-3 gap-4 mx-auto max-w-5xl">
{sites?.docs.length === 0 ? (
<div className="py-3 text-sm "></div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_home+/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function Footer() {
<Link
target="_blank"
className="hover:underline underline-offset-2 decoration-zinc-400 dark:decoration-zinc-500"
to="https://github.com/manawiki/mana"
to="https://github.com/manawiki"
>
Github
</Link>
Expand Down
38 changes: 21 additions & 17 deletions app/routes/_home+/components/GetStartedOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { Link } from "@remix-run/react";

export function GetStartedOptions() {
return (
<div className="dark:bg-zinc-800/10 bg-zinc-50/50 w-full z-10 relative max-laptop:px-6 border-t-2 border-b border-zinc-100 dark:border-dark350 pt-16 pb-24">
<div className="dark:bg-zinc-800/10 bg-zinc-50/50 dark:border-zinc-700 w-full z-10 relative max-laptop:px-6 border-t-2 border-b border-zinc-100 pt-16 pb-20">
<div className="max-w-5xl mx-auto px-5">
<div className="font-header text-2xl pb-1.5 text-center">
A wiki for everyone
A wiki for every{" "}
<span className="underline underline-offset-4 decoration-zinc-300 dark:decoration-zinc-600">
community
</span>
</div>
<div className="text-1 text-center">
Thriving wikis made easy. Choose the best way to get started.
Expand All @@ -33,24 +36,24 @@ export function GetStartedOptions() {
inline-flex items-center justify-center shadow shadow-zinc-100 dark:shadow-zinc-800/80 dark:border-zinc-600"
>
<Icon
name="server"
size={18}
name="github"
size={20}
className="text-zinc-500/70 dark:text-zinc-400"
/>
</div>
<div className="font-semibold pb-1 text-center">
One-click hosting
Open-source, self-host
</div>
<Text className="pb-4 text-center">
Get started with a hosted wiki in seconds on our fully
managed platform.
For developers and self-starters. Install and maintain on
your own server.
</Text>
<Link
className="bg-zinc-600 hover:bg-zinc-700 dark:hover:bg-zinc-500 inline-flex
text-white rounded-full px-3.5 py-1.5 text-xs mt-2 font-semibold"
to="/login"
to="https://github.com/manawiki"
>
Try for Free
Github Repo
</Link>
</div>
<div className="bg-white dark:bg-dark350 rounded-2xl p-3.5 pt-8 pb-5 text-center relative space-y-0.5 group">
Expand All @@ -71,26 +74,27 @@ export function GetStartedOptions() {
inline-flex items-center justify-center shadow shadow-zinc-100 dark:shadow-zinc-800/80 dark:border-zinc-600"
>
<Icon
name="github"
size={20}
name="server"
size={18}
className="text-zinc-500/70 dark:text-zinc-400"
/>
</div>
<div className="font-semibold pb-1 text-center">
Open-source, self-host
One-click hosting
</div>
<Text className="pb-4 text-center">
For developers and self-starters. Install and maintain on
your own server.
Get started with a hosted wiki in seconds on our fully
managed platform.
</Text>
<Link
className="bg-zinc-600 hover:bg-zinc-700 dark:hover:bg-zinc-500 inline-flex
text-white rounded-full px-3.5 py-1.5 text-xs mt-2 font-semibold"
to="https://github.com/manawiki/mana"
to="/login"
>
Github Repo
Try for Free
</Link>
</div>

<div className="bg-white dark:bg-dark350 rounded-2xl p-3.5 pt-8 pb-5 text-center relative space-y-0.5 group">
<div
className="shadow-sm shadow-zinc-300 dark:shadow-zinc-800 absolute -inset-2 bg-zinc-300/20 dark:bg-dark400 rounded-lg -z-10 before:absolute before:inset-y-0 before:left-0 before:w-[16px] before:bg-[length:16px_16px]
Expand Down Expand Up @@ -124,7 +128,7 @@ export function GetStartedOptions() {
<Link
className="bg-zinc-600 hover:bg-zinc-700 dark:hover:bg-zinc-500 inline-flex
text-white rounded-full px-3.5 py-1.5 text-xs mt-2 font-semibold"
to="/contact"
to="mailto:[email protected]"
>
Get in Touch
</Link>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_home+/components/Toolkit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function ToolKit() {
return (
<section className="relative max-laptop:px-5">
<div className="w-full py-20 relative z-20">
<div className="laptop:max-w-5xl mx-auto">
<div className="max-tablet:px-4 laptop:max-w-5xl mx-auto">
<div className="font-header text-2xl pb-1.5">
Not quite a wiki, quite a bit better
</div>
Expand Down
21 changes: 10 additions & 11 deletions app/routes/_home+/components/TopHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Image } from "~/components/Image";

import { ManaCore } from "./manacore";
import { Particles } from "./particles";

import { Link } from "@remix-run/react";
export function TopHome() {
return (
<section className="relative z-10 bg-zinc-900">
Expand Down Expand Up @@ -42,27 +42,26 @@ export function TopHome() {
data-aos="fade-down"
data-aos-delay="200"
>
Open-source, user-friendly, and fully customizable. Build
better wikis with Mana.
Powerful, extensible, and customisable. Collect and
organise knowledge with Mana.
</p>
<div
data-aos="fade-down"
data-aos-delay="400"
className="flex items-center justify-center gap-3.5"
>
<a
href="https://github.com/manawiki/mana"
target="_blank"
<Link
to="/join"
className="
relative inline-flex w-28 items-center justify-center gap-2 rounded-full border border-transparent
px-3 py-2.5 text-zinc-100 shadow-sm shadow-black/30 transition duration-150 ease-in-out
relative inline-flex w-32 items-center justify-center gap-1 rounded-full border border-transparent
px-3 pl-4 py-2.5 text-white shadow-sm shadow-black/30 transition duration-150 ease-in-out
[background:linear-gradient(theme(colors.zinc.800),_theme(colors.zinc.800))_padding-box,_conic-gradient(theme(colors.zinc.400),_theme(colors.zinc.700)_25%,_theme(colors.zinc.700)_75%,_theme(colors.zinc.400)_100%)_border-box]
before:pointer-events-none before:absolute before:inset-0 before:rounded-full before:bg-zinc-800/30 hover:text-white"
rel="noreferrer"
>
<Icon name="github" size={16} />
<span className="pt-0.5 text-sm font-bold">Github</span>
</a>
<span className="text-sm font-bold">Get Started</span>
<Icon name="chevron-right" size={14} />
</Link>
</div>
</div>
</div>
Expand Down
46 changes: 39 additions & 7 deletions app/routes/_seo+/sitemap[.]xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ import { getSiteSlug } from "~/routes/_site+/_utils/getSiteSlug.server";
import { fetchSite } from "../_site+/_utils/fetchSite.server";
import { fetchPublishedPosts } from "../_site+/posts+/utils/fetchPublishedPosts";

import {
authGQLFetcher,
authRestFetcher,
gqlFormat,
} from "~/utils/fetchers.server";
import { gql } from "graphql-request";

interface CustomEntry {
slug?: string;
id: string;
}

interface TotalCustomEntries {
entries: {
docs: CustomEntry[];
};
}

const toXmlSitemap = (urls: string[]) => {
const urlsAsXml = urls
.map((url) => `<url><loc>${url}</loc></url>`)
Expand Down Expand Up @@ -57,17 +75,31 @@ export async function loader({
overrideAccess: false,
});

// console.log("entries: ", entries);

const processCustomEntries = await Promise.all(
collections!.map(async (collection: Collection) => {
if (!collection.customDatabase) return [];

const url = `http://localhost:4000/api/${collection.slug}?depth=0&limit=0&select[slug]=true`;

const { docs } = await (await fetch(url)).json();
return docs.map(
({ slug, id }: any) =>
const label = gqlFormat(collection?.slug as string, "list");

const CUSTOM_ENTRIES_QUERY = gql`
query {
entries: ${label}(limit:12000) {
docs {
id
slug
}
}
}
`;

const totalCustomEntries = (await authGQLFetcher({
isAuthOverride: true,
isCustomDB: true,
document: CUSTOM_ENTRIES_QUERY,
})) as TotalCustomEntries;

return totalCustomEntries.entries.docs.map(
({ slug, id }: CustomEntry) =>
`${origin}/c/${collection.slug}/${slug ?? id}`,
);
}),
Expand Down
1 change: 1 addition & 0 deletions app/routes/inngest+/utils/updateSiteAnalytics.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const updateSiteAnalytics = inngest.createFunction(
//@ts-ignore
const { entryData }: { entryData: PaginatedDocs<Entry> } =
await authGQLFetcher({
isAuthOverride: true,
customPath:
customCollection && !!siteDomain
? `https://${siteDomain}:4000/api/graphql`
Expand Down
Loading

0 comments on commit 6188218

Please sign in to comment.