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 Sep 10, 2024
2 parents f9f9de3 + 44fed8e commit 4a9ea82
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 40 deletions.
2 changes: 2 additions & 0 deletions app/components/icons.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export type IconName =
| "hash"
| "corner-down-right"
| "chevrons-left"
| "square-plus"
| "message-square-plus"
Expand Down
3 changes: 0 additions & 3 deletions app/routes/_editor+/blocks+/group/group-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function BlockGroupItemView({ element }: { element: GroupItemElement }) {
<>
{element.isPost && element.iconUrl ? (
<Link
reloadDocument={element?.isCustomSite ?? false}
key={element?.id}
to={element?.path ?? ""}
// prefetch="intent"
Expand Down Expand Up @@ -62,7 +61,6 @@ export function BlockGroupItemView({ element }: { element: GroupItemElement }) {
</Link>
) : (
<Link
reloadDocument={element?.isCustomSite ?? false}
key={element?.id}
to={element?.path ?? ""}
// prefetch="intent"
Expand Down Expand Up @@ -138,7 +136,6 @@ export function BlockGroupItemView({ element }: { element: GroupItemElement }) {
</button>
)}
<NavLink
reloadDocument={element?.isCustomSite ?? false}
key={element?.id}
to={element?.path ?? ""}
// prefetch="intent"
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_editor+/core/components/EditorBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function EditorBlocks({
return (
<h3
id={id}
className="flex max-laptop:flex-col laptop:items-center dark:text-zinc-100 gap-3 mt-6 mb-2 font-header text-xl scroll-mt-20"
className="flex max-laptop:flex-col laptop:items-center dark:text-zinc-100 gap-1 tablet:gap-3 pb-1.5 mt-6 font-header text-xl scroll-mt-20"
{...attributes}
>
<div className="min-w-[10px] flex-none whitespace-pre-wrap">
Expand Down
4 changes: 1 addition & 3 deletions app/routes/_home+/components/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useDebouncedValue } from "~/utils/use-debounce";
import type { loader } from "../_index";

export function Discover() {
const { q, sites, dev } = useLoaderData<typeof loader>() || {};
const { q, sites } = useLoaderData<typeof loader>() || {};

const [query, setQuery] = useState(q);
const debouncedValue = useDebouncedValue(query, 500);
Expand Down Expand Up @@ -167,8 +167,6 @@ export function Discover() {
) : (
sites?.docs.map((site: Site) => (
<Link
//don't reload document on dev
reloadDocument={!dev}
to={
site.domain
? `https://${site.domain}`
Expand Down
1 change: 0 additions & 1 deletion app/routes/_site+/_components/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export function MobileHeader() {
</div>
)}
<Link
reloadDocument={true}
className="my-4 rounded-xl bg-zinc-800 px-5 py-3
text-center text-sm font-bold text-white dark:bg-zinc-200 dark:text-zinc-700"
to="https://mana.wiki"
Expand Down
9 changes: 6 additions & 3 deletions app/routes/_site+/_components/RampUnit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,21 @@ export function AdUnit({
const [startDetect, setStartDetect] = useState(true);
const [detected, setDetected] = useState(false);

// Run Adblock detection
useEffect(() => {
if (startDetect) {
if (startDetect && enableAds && process.env.NODE_ENV === "production") {
detectAdblock((enable) => {
setStartDetect(false);
setDetected(enable);
});
}
}, [startDetect]);
}, [startDetect, enableAds]);

if (!enableAds) return <></>;

className = className + " h-[250px] tablet:h-[90px]"; // set Default height to fix ad cls
// set Default height to fix ad cls, only in production when adblock is not detected
if (!detected && process.env.NODE_ENV === "production")
className = className + " h-[250px] tablet:h-[90px]";

return (
<ClientOnly fallback={<div className={className} />}>
Expand Down
4 changes: 1 addition & 3 deletions app/routes/_site+/_components/SiteHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Transition,
} from "@headlessui/react";
import { Link, useFetcher, useLoaderData } from "@remix-run/react";
import clsx from "clsx";
import { useTranslation } from "react-i18next";
import { InstantSearch } from "react-instantsearch";

Expand All @@ -24,9 +23,9 @@ import type { loader as siteLoaderType } from "~/routes/_site+/_layout";
import { isAdding } from "~/utils/form";

import { MenuTrayContent, MobileTray } from "./MobileTray";
import { DarkModeToggle } from "../action+/theme-toggle";
import { searchClient } from "../search/_search";
import { Autocomplete } from "../search/components/Autocomplete";
import { DarkModeToggle } from "../action+/theme-toggle";

export function SiteHeader({
setPrimaryMenuOpen,
Expand Down Expand Up @@ -198,7 +197,6 @@ export function SiteHeader({
<div className="flex items-center">
<Link
// prefetch="intent"
reloadDocument={true}
to={`/login?redirectTo=/`}
className="flex h-9 items-center justify-center rounded-full bg-zinc-700 px-3.5
text-sm font-bold text-white dark:bg-white dark:text-black max-laptop:hidden"
Expand Down
81 changes: 55 additions & 26 deletions app/routes/_site+/c_+/_components/TableOfContents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { SerializeFrom } from "@remix-run/node";
import { Link } from "@remix-run/react";
import clsx from "clsx";

import { Icon } from "~/components/Icon";
import type { Collection } from "~/db/payload-types";
Expand Down Expand Up @@ -53,48 +54,76 @@ export function TableOfContents({
<span>Table of Contents</span>
</div>
</div>
<div className="py-1.5">
<div className="py-3.5 space-y-2.5">
{sectionsList?.map((section) => (
<div key={section.id}>
<div className="py-1 group flex items-center relative -ml-1.5 hover:underline dark:decoration-zinc-500 decoration-zinc-300">
<div className="group flex items-center relative -ml-1.5 hover:underline dark:decoration-zinc-500 decoration-zinc-300">
<div
className="w-3 h-3 border group-hover:bg-zinc-200 dark:border-zinc-600 border-zinc-300 dark:group-hover:border-zinc-500
bg-zinc-100 dark:bg-dark500 rounded-full dark:shadow-zinc-800 dark:group-hover:bg-dark500"
className="size-3 border group-hover:bg-zinc-200 dark:border-zinc-600 border-zinc-300 dark:group-hover:border-zinc-500
bg-zinc-100 dark:bg-dark450 rounded-full dark:shadow-zinc-800 dark:group-hover:bg-dark500"
/>
<div className="w-3 h-[1px] dark:bg-zinc-700 bg-zinc-200" />
<Link
to={`#${section?.slug}`}
className="font-bold pl-2 py-1.5 flex items-center w-full gap-3 dark:hover:bg-dark450 border border-r-0 shadow-sm shadow-zinc-100
border-zinc-100 border-l-2 border-l-zinc-200/80 dark:border-l-zinc-600/80 dark:border-zinc-700 bg-white dark:bg-dark400 dark:shadow-zinc-800/50 hover:bg-zinc-100 rounded-l-lg"
className={clsx(
section?.subSections &&
section?.subSections?.length > 1
? "rounded-t-lg border-b-0"
: "rounded-lg shadow-sm shadow-zinc-100 dark:shadow-zinc-800/40",
"font-bold pl-2 pr-2.5 mr-3 py-1.5 flex items-center w-full gap-1.5 dark:hover:bg-dark450 border border-color-sub bg-white dark:bg-dark400 hover:bg-zinc-100 ",
)}
>
<span>{section.name}</span>
<Icon
name="hash"
size={12}
className="dark:text-zinc-500 text-zinc-400"
/>
<span className="pr-1">{section.name}</span>
<div className="border-t border-dotted border-zinc-300/80 dark:border-zinc-600 flex-grow" />
<Icon
name="chevron-down"
size={14}
className="dark:text-zinc-500 text-zinc-400"
/>
</Link>
</div>
{section.subSections &&
section.subSections?.length === 1 ? null : (
<div className="space-y-1">
(section.subSections?.length === 1 ||
section.subSections?.length === 0) ? null : (
<div
className={clsx(
section?.subSections &&
section?.subSections?.length > 1
? "rounded-b-lg"
: "rounded-lg",
"border border-color-sub overflow-hidden divide-y divide-color-sub mr-3 ml-[16.5px] tablet:ml-[17px] bg-3-sub shadow-sm shadow-zinc-100 dark:shadow-zinc-800/50",
)}
>
{section.subSections?.map((subSection) => (
<div
<Link
key={subSection.id}
className="group flex w-full items-center relative dark:decoration-zinc-500 decoration-zinc-300"
className="group flex w-full items-center justify-between relative dark:hover:bg-dark450 hover:bg-zinc-50 dark:decoration-zinc-500 decoration-zinc-300 px-2.5 py-2 text-xs font-bold"
to={
section.viewType == "rows"
? `#${subSection?.slug}`
: `?section=${subSection?.slug}#${section?.slug}`
}
>
<div
className="w-[4px] h-4 group-hover:bg-zinc-300 -ml-[1px]
bg-zinc-200 dark:bg-dark450 rounded-r-sm dark:group-hover:bg-dark500"
<div className="flex items-center gap-2">
<Icon
name="corner-down-right"
size={14}
className="dark:text-zinc-500 text-zinc-400"
/>
{/* <span className="dark:bg-zinc-600 bg-zinc-300 size-1.5 rounded-full" /> */}
<span>{subSection.name}</span>
</div>
<Icon
name="chevron-down"
size={14}
className="dark:text-zinc-500 text-zinc-400"
/>
<Link
to={
section.viewType == "rows"
? `#${subSection?.slug}`
: `?section=${subSection?.slug}#${section?.slug}`
}
className="font-bold bg-white dark:bg-dark400 dark:hover:bg-dark450 hover:bg-zinc-100
flex items-center gap-3 text-sm rounded-l-xl pl-2 ml-4 text-1 w-full py-1.5"
>
{subSection.name}
</Link>
</div>
</Link>
))}
</div>
)}
Expand Down
17 changes: 17 additions & 0 deletions public/icons/corner-down-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions public/icons/hash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4a9ea82

Please sign in to comment.