Skip to content

Commit 3e7c48d

Browse files
better loading states
1 parent 2112c97 commit 3e7c48d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/routes/home/Editor.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface EditorProps
2424
setIsSearchDialogOpen: (open: boolean) => void;
2525
toggleSidebar: () => void;
2626
createNewSnippet: () => void;
27+
loading?: boolean;
2728
}
2829

2930
const MonacoEditorComponent: React.FC<EditorProps> = ({
@@ -38,6 +39,7 @@ const MonacoEditorComponent: React.FC<EditorProps> = ({
3839
toggleSidebar,
3940
createNewSnippet,
4041
snippets,
42+
loading,
4143
}) => {
4244
const editorRef = useRef<any>(null);
4345
const editorInstance = useRef<any>(null);
@@ -187,7 +189,9 @@ const MonacoEditorComponent: React.FC<EditorProps> = ({
187189
className="flex-1 relative"
188190
style={{ height: isPreviewing ? "50%" : "100%" }}
189191
>
190-
{!hasSnippets ? (
192+
{loading ? (
193+
<Skeleton className="flex flex-1 w-full h-full" />
194+
) : !hasSnippets ? (
191195
<div className="flex flex-col items-center justify-center h-full">
192196
<Sparkles className="w-12 h-12 sm:w-24 sm:h-24 text-primary" />
193197
<span className="text-sm sm:text-base text-center text-muted-foreground">

src/routes/home/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function Home() {
100100
isPreviewing={isPreviewing}
101101
toggleSidebar={toggleSidebar}
102102
createNewSnippet={createNewSnippet}
103+
loading={snippetHelpers.loading}
103104
/>
104105
{isPreviewing && hasSnippets && (
105106
<div className="h-1/2 overflow-auto w-full border-t">

0 commit comments

Comments
 (0)