diff --git a/apps/www/package.json b/apps/www/package.json index 1b9dd74..d1ac4e7 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -25,7 +25,7 @@ "@milkdown/plugin-listener": "^7.9.0", "@milkdown/preset-commonmark": "^7.9.0", "@milkdown/react": "^7.9.0", - "@milkdown/theme-nord": "^7.9.0", + "@milkdown/theme-nord": "^7.9.1", "@monaco-editor/react": "^4.6.0", "@number-flow/react": "^0.5.7", "@radix-ui/react-aspect-ratio": "1.1.1", diff --git a/apps/www/src/app/(main)/misc/see-waitlist-codes/page.tsx b/apps/www/src/app/(main)/misc/see-waitlist-codes/page.tsx index e69de29..64d3ce1 100644 --- a/apps/www/src/app/(main)/misc/see-waitlist-codes/page.tsx +++ b/apps/www/src/app/(main)/misc/see-waitlist-codes/page.tsx @@ -0,0 +1,29 @@ +/* + * MHSF, Minehut Server List + * All external content is rather licensed under the ECA Agreement + * located here: https://mhsf.app/docs/legal/external-content-agreement + * + * All code under MHSF is licensed under the MIT License + * by open source contributors + * + * Copyright (c) 2025 dvelo + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ \ No newline at end of file diff --git a/apps/www/src/components/feat/server-page/server-editor/server-editor-description.tsx b/apps/www/src/components/feat/server-page/server-editor/server-editor-description.tsx index e69de29..93aab10 100644 --- a/apps/www/src/components/feat/server-page/server-editor/server-editor-description.tsx +++ b/apps/www/src/components/feat/server-page/server-editor/server-editor-description.tsx @@ -0,0 +1,56 @@ +/* + * MHSF, Minehut Server List + * All external content is rather licensed under the ECA Agreement + * located here: https://mhsf.app/docs/legal/external-content-agreement + * + * All code under MHSF is licensed under the MIT License + * by open source contributors + * + * Copyright (c) 2025 dvelo + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +import { listenerCtx } from '@milkdown/kit/plugin/listener'; +import { Crepe } from '@milkdown/crepe'; +import { Milkdown, useEditor } from '@milkdown/react'; + +import '@milkdown/crepe/theme/common/style.css'; +import '@milkdown/crepe/theme/nord-dark.css'; + +export function ServerEditorDescription({ defaultMarkdown, onUpdate }: { defaultMarkdown: string, onUpdate?: (update: string) => void }) { + useEditor((root) => { + const crepe = new Crepe({ + root, + defaultValue: defaultMarkdown, + }); + crepe.editor.config(async (ctx) => { + ctx.get(listenerCtx).markdownUpdated((_, markdown) => { + if (onUpdate) + onUpdate(markdown); + }); + }); + return crepe; + }, []); + + return ( + + ); +} diff --git a/apps/www/src/components/feat/server-page/server-editor/server-editor-provider.tsx b/apps/www/src/components/feat/server-page/server-editor/server-editor-provider.tsx index 36037a0..b4661fb 100644 --- a/apps/www/src/components/feat/server-page/server-editor/server-editor-provider.tsx +++ b/apps/www/src/components/feat/server-page/server-editor/server-editor-provider.tsx @@ -1,8 +1,14 @@ import { Dialog, DialogContent } from "@/components/ui/dialog"; import { Drawer, DrawerContent, DrawerTitle } from "@/components/ui/drawer"; -import { ReactNode, useEffect, useState } from "react"; +import { type ReactNode, useEffect, useState } from "react"; +import { ServerEditorDescription } from "./server-editor-description"; +import type { useMHSFServer } from "@/lib/hooks/use-mhsf-server"; +import { MilkdownProvider } from "@milkdown/react"; +import { Material } from "@/components/ui/material"; +import { Placeholder } from "@/components/ui/placeholder"; +import { X } from "lucide-react"; -export function ServerEditorProvider({children}: {children: ReactNode | ReactNode[]}) { +export function ServerEditorProvider({ children, serverData }: { children: ReactNode | ReactNode[], serverData: ReturnType }) { const [open, setOpen] = useState(false); useEffect(() => { @@ -11,11 +17,25 @@ export function ServerEditorProvider({children}: {children: ReactNode | ReactNod return <> {children} - - - Server Settings + + + + {serverData.server?.customizationData.isOwnedByUser ?
- - + + Server Settings + + + Server Description +

A markdown enabled, fancy description for your server! Describe what players will expect from your server and why they should join; don't worry, you have more space than MOTD's.

+ {!serverData.loading && } +
+
: } className="h-full justify-center flex items-center" title="You don't own this server" description="Unfortunately, that one ain't gonna work. Atleast not on my watch."/>} + + + +
+
+
} \ No newline at end of file diff --git a/apps/www/src/components/feat/server-page/server-provider.tsx b/apps/www/src/components/feat/server-page/server-provider.tsx index bec5739..7b72db2 100644 --- a/apps/www/src/components/feat/server-page/server-provider.tsx +++ b/apps/www/src/components/feat/server-page/server-provider.tsx @@ -72,7 +72,7 @@ export function ServerProvider({ serverId }: { serverId: string }) { ) : (
- +