refactor: update UI components by removing unused imports and adjusting loading states

This commit is contained in:
Anish Sarkar 2026-04-01 20:51:55 +05:30
parent d7dd6db1b9
commit 5c11a15fb6
6 changed files with 20 additions and 24 deletions

View file

@ -60,7 +60,7 @@ export function CommunityPromptsContent() {
{list.length === 0 && ( {list.length === 0 && (
<div className="rounded-lg border border-dashed border-border/60 p-8 text-center"> <div className="rounded-lg border border-dashed border-border/60 p-8 text-center">
<Globe className="mx-auto size-8 text-muted-foreground/40" /> <Globe className="mx-auto size-8 text-muted-foreground" />
<p className="mt-2 text-sm text-muted-foreground">No community prompts yet</p> <p className="mt-2 text-sm text-muted-foreground">No community prompts yet</p>
<p className="text-xs text-muted-foreground/60"> <p className="text-xs text-muted-foreground/60">
Share your own prompts from the My Prompts tab Share your own prompts from the My Prompts tab

View file

@ -1,7 +1,8 @@
"use client"; "use client";
import { useAtomValue } from "jotai"; import { useAtomValue } from "jotai";
import { AlertTriangle, Globe, Lock, PenLine, Plus, Sparkles, Trash2 } from "lucide-react"; import { AlertTriangle, Globe, Lock, PenLine, Sparkles, Trash2 } from "lucide-react";
import { ShortcutKbd } from "@/components/ui/shortcut-kbd";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
import { import {
@ -145,7 +146,7 @@ export function PromptsContent() {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
Create prompt templates triggered with{" "} Create prompt templates triggered with{" "}
<kbd className="rounded border bg-muted px-1.5 py-0.5 text-xs font-mono">/</kbd> in the <ShortcutKbd keys={["/"]} className="ml-0" /> in the
chat composer. chat composer.
</p> </p>
{!showForm && ( {!showForm && (
@ -158,7 +159,6 @@ export function PromptsContent() {
}} }}
className="shrink-0 gap-1.5" className="shrink-0 gap-1.5"
> >
<Plus className="size-3.5" />
New New
</Button> </Button>
)} )}

View file

@ -9,24 +9,9 @@ import { closeEditorPanelAtom, editorPanelAtom } from "@/atoms/editor/editor-pan
import { MarkdownViewer } from "@/components/markdown-viewer"; import { MarkdownViewer } from "@/components/markdown-viewer";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer"; import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer";
import { Skeleton } from "@/components/ui/skeleton";
import { useMediaQuery } from "@/hooks/use-media-query"; import { useMediaQuery } from "@/hooks/use-media-query";
import { authenticatedFetch, getBearerToken, redirectToLogin } from "@/lib/auth-utils"; import { authenticatedFetch, getBearerToken, redirectToLogin } from "@/lib/auth-utils";
const PlateEditor = dynamic(
() => import("@/components/editor/plate-editor").then((m) => ({ default: m.PlateEditor })),
{ ssr: false, loading: () => <Skeleton className="h-64 w-full" /> }
);
interface EditorContent {
document_id: number;
title: string;
document_type?: string;
source_markdown: string;
}
const EDITABLE_DOCUMENT_TYPES = new Set(["FILE", "NOTE"]);
function EditorPanelSkeleton() { function EditorPanelSkeleton() {
return ( return (
<div className="space-y-6 p-6"> <div className="space-y-6 p-6">
@ -47,6 +32,20 @@ function EditorPanelSkeleton() {
); );
} }
const PlateEditor = dynamic(
() => import("@/components/editor/plate-editor").then((m) => ({ default: m.PlateEditor })),
{ ssr: false, loading: () => null }
);
interface EditorContent {
document_id: number;
title: string;
document_type?: string;
source_markdown: string;
}
const EDITABLE_DOCUMENT_TYPES = new Set(["FILE", "NOTE"]);
export function EditorPanelContent({ export function EditorPanelContent({
documentId, documentId,
searchSpaceId, searchSpaceId,

View file

@ -19,7 +19,7 @@ const EditorPanelContent = dynamic(
import("@/components/editor-panel/editor-panel").then((m) => ({ import("@/components/editor-panel/editor-panel").then((m) => ({
default: m.EditorPanelContent, default: m.EditorPanelContent,
})), })),
{ ssr: false, loading: () => <Skeleton className="h-96 w-full" /> } { ssr: false, loading: () => null }
); );
const HitlEditPanelContent = dynamic( const HitlEditPanelContent = dynamic(

View file

@ -1,7 +1,7 @@
"use client"; "use client";
import { useAtomValue } from "jotai"; import { useAtomValue } from "jotai";
import { AlertCircle, Edit3, Info, Plus, RefreshCw, Trash2, Wand2 } from "lucide-react"; import { AlertCircle, Edit3, Info, RefreshCw, Trash2, Wand2 } from "lucide-react";
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import { deleteImageGenConfigMutationAtom } from "@/atoms/image-gen-config/image-gen-config-mutation.atoms"; import { deleteImageGenConfigMutationAtom } from "@/atoms/image-gen-config/image-gen-config-mutation.atoms";
import { import {
@ -257,7 +257,6 @@ export function ImageModelManager({ searchSpaceId }: ImageModelManagerProps) {
size="lg" size="lg"
className="gap-2 text-xs md:text-sm h-9 md:h-10" className="gap-2 text-xs md:text-sm h-9 md:h-10"
> >
<Plus className="h-3 w-3 md:h-4 md:w-4" />
Add First Image Model Add First Image Model
</Button> </Button>
)} )}

View file

@ -7,7 +7,6 @@ import {
FileText, FileText,
Info, Info,
MessageSquareQuote, MessageSquareQuote,
Plus,
RefreshCw, RefreshCw,
Trash2, Trash2,
Wand2, Wand2,
@ -270,7 +269,6 @@ export function ModelConfigManager({ searchSpaceId }: ModelConfigManagerProps) {
size="lg" size="lg"
className="gap-2 text-xs md:text-sm h-9 md:h-10" className="gap-2 text-xs md:text-sm h-9 md:h-10"
> >
<Plus className="h-3 w-3 md:h-4 md:w-4" />
Create First Configuration Create First Configuration
</Button> </Button>
)} )}