feat: dark-tech UI redesign + markdown patch cards
Redesign the frontend with a dark-tech theme: add Tailwind + PostCSS, design tokens, and shadcn-style primitives (Button/Card/Input/Dialog/ DropdownMenu/Tabs/ScrollArea/etc.); restyle the app shell, navigation, sidebar tree, content view, markdown rendering, editors, modals and settings panels. Behavior/props unchanged; Font Awesome replaced with lucide-react. Add the patch cards feature UI: patch-queries hooks and a PatchCards component rendered below the markdown body, with an Add Patch button and create/edit dialog. Fix tree expandability: folders with an index page now expand on name click (and navigate), and the chevron+folder icon is one larger toggle. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
import {useCreateMarkdownSetting, useMarkdownSetting} from "../../utils/queries/markdown-setting-queries";
|
||||
import {useSaveMarkdown} from "../../utils/queries/markdown-queries";
|
||||
import React, {useState} from "react";
|
||||
import { Plus } from "lucide-react";
|
||||
import MarkdownTemplateSettingPanel from "../Settings/MarkdownSettings/MarkdownTemplateSettingPanel";
|
||||
import MarkdownPermissionSettingPanel from "../Settings/MarkdownSettings/MarkdownPermissionSettingPanel";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "../ui/dialog";
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/tabs";
|
||||
import { Button } from "../ui/button";
|
||||
import { Spinner } from "../ui/misc";
|
||||
|
||||
const MarkdownSettingModal = ({isOpen, markdown, onClose}) => {
|
||||
const {data: markdownSetting, isFetching: markdownSettingIsFetching} = useMarkdownSetting(markdown?.setting_id || 0);
|
||||
@@ -24,62 +34,45 @@ const MarkdownSettingModal = ({isOpen, markdown, onClose}) => {
|
||||
});
|
||||
};
|
||||
|
||||
if(markdownSettingIsFetching)
|
||||
return(<p>Loading...</p>);
|
||||
|
||||
return (
|
||||
<div className={`modal ${isOpen ? "is-active" : ""}`}>
|
||||
<div className="modal-background" onClick={onClose} />
|
||||
<div className="modal-card" style={{width: "60vw"}}>
|
||||
<header className="modal-card-head">
|
||||
<p className="modal-card-title">Markdown Settings</p>
|
||||
<button
|
||||
className="delete"
|
||||
<Dialog open={isOpen} onOpenChange={(o) => { if (!o) onClose(); }}>
|
||||
<DialogContent className="max-w-3xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Markdown Settings</DialogTitle>
|
||||
</DialogHeader>
|
||||
{markdownSettingIsFetching ? (
|
||||
<div className="flex justify-center py-10">
|
||||
<Spinner label="Loading settings" />
|
||||
</div>
|
||||
) : markdownSetting ? (
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
||||
<TabsList>
|
||||
<TabsTrigger value="template">Template</TabsTrigger>
|
||||
<TabsTrigger value="permission">Permission</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="template">
|
||||
<MarkdownTemplateSettingPanel
|
||||
markdownSetting={markdownSetting}
|
||||
onClose={onClose}
|
||||
/>
|
||||
</TabsContent>
|
||||
<TabsContent value="permission">
|
||||
<MarkdownPermissionSettingPanel
|
||||
markdownSetting={markdownSetting}
|
||||
onClose={onClose}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
) : (
|
||||
<Button
|
||||
type="button"
|
||||
aria-label="close"
|
||||
onClick={onClose}
|
||||
/>
|
||||
</header>
|
||||
{
|
||||
markdownSetting ? (
|
||||
<section className="modal-card-body">
|
||||
<div className="tabs">
|
||||
<ul>
|
||||
<li className={activeTab==="template" ? "is-active" : ""}>
|
||||
<a onClick={() => setActiveTab("template")}>Template</a>
|
||||
</li>
|
||||
<li className={activeTab==="permission" ? "is-active" : ""}>
|
||||
<a onClick={() => setActiveTab("permission")}>Permission</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{activeTab === "template" && (
|
||||
<MarkdownTemplateSettingPanel
|
||||
markdownSetting={markdownSetting}
|
||||
onClose={onClose}
|
||||
/>
|
||||
)}
|
||||
{activeTab === "permission" && (
|
||||
<MarkdownPermissionSettingPanel
|
||||
markdownSetting={markdownSetting}
|
||||
onClose={onClose}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
) : (
|
||||
<section className="modal-card-body">
|
||||
<button
|
||||
className="button is-primary"
|
||||
type="button"
|
||||
onClick={handleCreateMarkdownSetting}
|
||||
>
|
||||
Create Markdown Setting
|
||||
</button>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
onClick={handleCreateMarkdownSetting}
|
||||
>
|
||||
<Plus className="h-4 w-4" /> Create Markdown Setting
|
||||
</Button>
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user