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 Aug 16, 2024
2 parents f2dd111 + fad742d commit 97f3ebe
Show file tree
Hide file tree
Showing 26 changed files with 202 additions and 204 deletions.
11 changes: 10 additions & 1 deletion app/_custom/hooks/search-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ export const afterChangeSearchSyncHook: CollectionAfterChangeHook = async ({
domain ? domain : `${process.env.SITE_SLUG}.mana.wiki`
}${entryRelativeURL}`;

const iconUrl = doc?.icon?.url;
//Due to the way Payload handles depth in relationships, we need to fetch the icon URL if it exists
const { url: iconUrl } = doc?.icon?.url
? doc?.icon
: doc?.icon
? await payload.findByID({
collection: "images",
id: doc?.icon,
depth: 0,
})
: null;

await typesensePrivateClient
.collections("entries")
Expand Down
10 changes: 4 additions & 6 deletions app/components/Headers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import clsx from "clsx";

export const H2 = ({ text }: { text: string | undefined }) => {
return (
<h2
Expand All @@ -26,19 +24,19 @@ export const H2Plain = ({
}) => {
return (
<h2
className="dark:text-zinc-100 mt-8 mb-3 pl-3.5 leading-7 dark:bg-dark400 bg-zinc-50 block shadow-sm dark:shadow-zinc-800/70 border-zinc-200/70
font-header relative text-lg scroll-mt-32 laptop:scroll-mt-60 rounded-l rounded-r-md py-2 overflow-hidden border shadow-zinc-50 dark:border-zinc-700"
className="dark:text-zinc-100 mt-8 mb-3 pl-3.5 leading-7 dark:bg-dark400 bg-zinc-100 block shadow-sm dark:shadow-zinc-800/70 border-zinc-300
font-header relative text-lg scroll-mt-32 laptop:scroll-mt-60 rounded-l rounded-r-md py-2 overflow-hidden border shadow-zinc-50 dark:border-zinc-600"
>
<span className="z-10 relative">{text}</span>
<span
contentEditable={false}
className="h-full inline-flex top-0 w-1.5 dark:bg-zinc-600/30 bg-zinc-200/70 absolute left-0 z-10"
className="h-full inline-flex top-0 w-1.5 dark:bg-zinc-600 bg-zinc-200 absolute left-0 z-10"
/>
<div
contentEditable={false}
className="pattern-dots absolute left-0
top-0 z-0 h-full
w-full pattern-bg-white pattern-zinc-500 pattern-opacity-10
w-full pattern-bg-white pattern-zinc-600 pattern-opacity-10
pattern-size-1 dark:pattern-zinc-400 dark:pattern-bg-bg3Dark"
/>
</h2>
Expand Down
14 changes: 6 additions & 8 deletions app/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
export type ManaConfig = {
title: string;
fromEmail: string;
fromName: string;
title?: string; //Title of the site, used in meta tags
fromEmail?: string; //Email address to send emails from
fromName?: string; //Name to send emails from
typesenseHost?: string; //Host of the typesense server
typesenseSearchOnlyKey?: string; //API key that only allows search operations
};

export const settings: ManaConfig = {
title: "Mana - The all-in-one wiki builder",
fromEmail: "[email protected]",
fromName: "No Reply - Mana Wiki",
};
export const settings: ManaConfig = {};
16 changes: 16 additions & 0 deletions app/db/collections/collections/collections-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ export const Collections: CollectionConfig = {
update: isStaffFieldLevel,
},
},
{
name: "defaultViewType",
type: "select",
required: true,
defaultValue: "list",
options: [
{
label: "List",
value: "list",
},
{
label: "Grid",
value: "grid",
},
],
},
{
name: "hiddenCollection",
type: "checkbox",
Expand Down
2 changes: 1 addition & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const loader = async ({
};

export const meta: MetaFunction<typeof loader> = ({ data }) => [
{ title: settings.title },
{ title: settings?.title ?? "Mana - The all-in-one wiki builder" },
{ charSet: "utf-8" },
];

Expand Down
8 changes: 4 additions & 4 deletions app/routes/_editor+/core/components/EditorBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ export function EditorBlocks({
return (
<h2
id={id}
className="dark:text-zinc-100 mt-8 mb-3 pl-3.5 leading-7 dark:bg-dark400 bg-zinc-50 block shadow-sm dark:shadow-zinc-800/70 border-zinc-200/70
font-header relative text-lg scroll-mt-32 laptop:scroll-mt-60 rounded-l rounded-r-md py-2 overflow-hidden border shadow-zinc-50 dark:border-zinc-700"
className="dark:text-zinc-100 mt-8 mb-3 pl-3.5 leading-7 dark:bg-dark400 bg-zinc-100 block shadow-sm dark:shadow-zinc-800/70 border-zinc-300
font-header relative text-lg scroll-mt-32 laptop:scroll-mt-60 rounded-l rounded-r-md py-2 overflow-hidden border shadow-zinc-50 dark:border-zinc-600"
{...attributes}
>
<span className="z-10 relative">{children}</span>
<span
contentEditable={false}
className="h-full inline-flex top-0 w-1.5 dark:bg-zinc-600/30 bg-zinc-200/70 absolute left-0 z-10"
className="h-full inline-flex top-0 w-1.5 dark:bg-zinc-600 bg-zinc-200 absolute left-0 z-10"
/>
<div
contentEditable={false}
className="pattern-dots absolute left-0
top-0 z-0 h-full
w-full pattern-bg-white pattern-zinc-500 pattern-opacity-10
w-full pattern-bg-white pattern-zinc-600 pattern-opacity-10
pattern-size-1 dark:pattern-zinc-400 dark:pattern-bg-bg3Dark"
/>
</h2>
Expand Down
12 changes: 6 additions & 6 deletions app/routes/_site+/_components/Column-2.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { useEffect, useState } from "react";

import { useLoaderData, useLocation } from "@remix-run/react";

import { Icon } from "~/components/Icon";
import { AdminOrStaffOrOwner } from "~/routes/_auth+/components/AdminOrStaffOrOwner";
import { NotAdminOrStaffOrOwner } from "~/routes/_auth+/components/NotAdminOrStaffOrOwner";
import type { loader as siteLoaderType } from "~/routes/_site+/_layout";

import { PrimaryMenu } from "./PrimaryMenu";
import { SideMenu } from "./sidemenu/SideMenu";
import { AdminOrStaffOrOwner } from "~/routes/_auth+/components/AdminOrStaffOrOwner";
import { ViewSideMenu } from "./sidemenu/ViewSideMenu";
import { NotAdminOrStaffOrOwner } from "~/routes/_auth+/components/NotAdminOrStaffOrOwner";
import { PrimaryMenu } from "./PrimaryMenu";
import { Icon } from "~/components/Icon";
import { useEffect, useState } from "react";
import { Button } from "~/components/Button";

export function ColumnTwo({
setPrimaryMenuOpen,
Expand Down
8 changes: 6 additions & 2 deletions app/routes/_site+/_components/Column-4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ export function ColumnFour() {
</div>
</div>
<section
className="max-laptop:bg-3 flex-1 relative shadow-sm shadow-1 max-laptop:min-h-[300px] laptop:min-h-[500px]
className="max-laptop:bg-3 flex-1 relative shadow-sm shadow-1 min-h-[480px]
bg-white/50 dark:bg-bg3Dark/30 border-y border-color"
>
<div className="absolute inset-0 overflow-auto divide-y divide-dotted divide-color">
<div
className="absolute inset-0 overflow-auto divide-y divide-dotted divide-color
dark:scrollbar-thumb-dark500 dark:scrollbar-track-bg3Dark pb-[50px]
scrollbar-thumb-zinc-200 scrollbar-track-white scrollbar"
>
{/* @ts-ignore */}
{site?.trendingPages?.map((row: any) => (
<Link
Expand Down
2 changes: 2 additions & 0 deletions app/routes/_site+/_utils/fetchSite.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const QUERY = gql`
id
name
slug
sections {
id
slug
Expand All @@ -156,6 +157,7 @@ const QUERY = gql`
type
}
}
defaultViewType
customDatabase
customEntryTemplate
customListTemplate
Expand Down
9 changes: 1 addition & 8 deletions app/routes/_site+/c_+/$collectionId/_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,5 @@ export default function CollectionList() {
),
}),
];
return (
<List
key={collectionId}
columns={columns}
gridView={gridView}
viewType="list"
/>
);
return <List key={collectionId} columns={columns} gridView={gridView} />;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { Fragment } from "react";

import { Popover, Transition } from "@headlessui/react";
import { Link } from "@remix-run/react";
import type { SerializeFrom } from "@remix-run/server-runtime";

import { Icon } from "~/components/Icon";
import { Tooltip, TooltipContent, TooltipTrigger } from "~/components/Tooltip";
import type { Collection } from "~/db/payload-types";
import type { loader as entryLoaderType } from "~/routes/_site+/c_+/$collectionId_.$entryId/_entry";

Expand All @@ -14,157 +8,31 @@ import { SectionTitle } from "./SectionTitle";
// eslint-disable-next-line import/no-cycle
import { SubSection } from "./SubSection";
import { SubSectionTabs } from "./SubSectionTabs";
import { TableOfContents } from "../../_components/TableOfContents";

export function SectionParent({
section,
sections,
customData,
customComponents,
entry,
activeSection,
hasAccess,
}: {
section: Flatten<Collection["sections"]>;
sections: Collection["sections"];
customData: unknown;
customComponents: unknown;
entry: SerializeFrom<typeof entryLoaderType>["entry"];
activeSection: string | null;
hasAccess: Boolean;
}) {
if (sections && section?.subSections) {
const isSingle =
section?.subSections && section?.subSections?.length == 1;

const isActiveSection = activeSection === section?.slug;

const activeSectionName = sections?.find(
(element) => isActiveSection && element.slug === activeSection,
)?.name;

const activeSectionIndex = sections?.findIndex(
(element) => isActiveSection && element.slug === activeSection,
);

const prevToCItem =
sections[
(activeSectionIndex + sections?.length - 1) % sections?.length
];

const nextToCItem = sections[(activeSectionIndex + 1) % sections?.length];

const showToBottomArrow = activeSectionIndex == 0;

const showToTopArrow = activeSectionIndex == sections?.length - 1;

return (
<>
{isActiveSection && (
<div
className="fixed top-[117px] left-0 max-tablet:px-3 laptop:top-[61px] bg-3-sub laptop:shadow-sm shadow-1 px-2.5 py-2 laptop:pb-3 laptop:pt-3.5
flex items-center w-full z-50 laptop:z-30 max-laptop:py-3 mx-auto border-y laptop:border-t-0 dark:border-zinc-600/50"
>
<div className="flex items-center w-full justify-between laptop:ml-36 desktop:ml-[300px] laptop:mr-80">
<div className="flex items-center gap-2.5">
<Popover>
{({ open }) => (
<>
<Popover.Button className="w-6 h-6 dark:bg-dark450 bg-zinc-100 hover:bg-zinc-200 dark:hover:bg-dark500 flex items-center justify-center rounded-md">
{open ? (
<Icon
name="chevron-left"
className="text-1"
size={14}
/>
) : (
<Icon
name="list"
size={16}
className="text-1"
/>
)}
</Popover.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute w-full mt-3.5 laptop:mt-5 drop-shadow-xl left-0 transform">
<div className="flex items-center justify-center laptop:pl-[138px] desktop:pl-[306px] laptop:pr-[340px]">
<TableOfContents
entry={entry}
sections={sections}
/>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
<div className="font-bold text-sm">
{activeSectionName}
</div>
</div>
{isActiveSection && (
<div className="flex items-center gap-1 laptop:pr-4">
<Tooltip setDelay={1000} placement="top">
<TooltipTrigger title="Next Section" asChild>
<Link
to={`#${prevToCItem?.id}`}
className="p-1.5 block rounded-md hover:bg-zinc-100 dark:hover:bg-dark450"
>
<Icon
name={
showToBottomArrow
? "chevrons-down"
: "arrow-up"
}
size={16}
className="text-1"
/>
</Link>
</TooltipTrigger>
<TooltipContent>
{showToBottomArrow ? "To Last" : "To Previous"}
</TooltipContent>
</Tooltip>
<Tooltip setDelay={1000} placement="top">
<TooltipTrigger title="Previous Section" asChild>
<Link
to={`#${nextToCItem?.id}`}
className="p-1.5 block rounded-md hover:bg-zinc-100 dark:hover:bg-dark450"
>
<Icon
name={
showToTopArrow
? "chevrons-up"
: "arrow-down"
}
size={16}
className="text-1"
/>
</Link>
</TooltipTrigger>
<TooltipContent>
{showToTopArrow ? "To First" : "To Next"}
</TooltipContent>
</Tooltip>
</div>
)}
</div>
</div>
)}

{isSingle ? (
<div
data-section
id={section?.slug ?? ""}
className="scroll-mt-32 laptop:scroll-mt-[126px] max-w-[728px] mx-auto"
className="scroll-mt-32 laptop:scroll-mt-20 max-w-[728px] mx-auto"
>
<SectionTitle section={section} />
<SubSection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Link } from "@remix-run/react";
import clsx from "clsx";

import type { Collection } from "~/db/payload-types";

Expand All @@ -17,14 +16,14 @@ export function SectionTitle({
<div className="max-w-[728px] mx-auto">
<Link to={`#${section?.slug}`}>
<h2
className="border-color-sub border-zinc-200/80 relative
className="dark:border-zinc-600 border-zinc-300 relative bg-zinc-100
mt-8 overflow-hidden rounded-lg shadow-sm dark:shadow-black/20 mb-2.5 border-2
font-header text-xl font-bold dark:bg-dark400"
font-header text-xl font-bold dark:bg-dark450"
>
<div
className="pattern-dots absolute left-0 top-0 -z-0 h-full
w-full pattern-bg-white pattern-zinc-400 pattern-opacity-10
pattern-size-4 dark:pattern-zinc-500 dark:pattern-bg-bg3Dark"
w-full pattern-bg-white pattern-zinc-500 pattern-opacity-10
pattern-size-4 dark:pattern-zinc-400 dark:pattern-bg-bg3Dark"
/>
<div className="flex items-center gap-2">
<div className="relative h-full px-3.5 flex-grow py-2.5">
Expand Down
Loading

0 comments on commit 97f3ebe

Please sign in to comment.