Skip to content

Commit

Permalink
notebooks, batch-changes: tweak loading
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Dec 14, 2024
1 parent 252f7c1 commit a8d895f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
18 changes: 8 additions & 10 deletions src/components/FindNotebooksCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function FindNotebooksCommand({ src }: { src: Sourcegraph }) {
selectedItemId={length > 0 ? "first-result" : undefined}
throttle
>
{!loading && !searchText ? (
{!loading && !searchText && (
<List.Section title={"Suggestions"}>
<List.Item
title="Create a search notebook"
Expand All @@ -63,17 +63,15 @@ export default function FindNotebooksCommand({ src }: { src: Sourcegraph }) {
}
/>
</List.Section>
) : (
<Fragment />
)}

{notebooks && (
<List.Section title={searchText ? "Notebooks" : "Recent notebooks"}>
{notebooks.map((n, i) => (
<NotebookResultItem id={i === 0 ? "first-result" : undefined} key={nanoid()} notebook={n} src={src} />
))}
</List.Section>
)}
{loading && length === 0 && <List.EmptyView icon={Icon.MugSteam} title={"Loading..."} />}

<List.Section title={searchText ? "Notebooks" : "Recent notebooks"}>
{notebooks?.map((n, i) => (
<NotebookResultItem id={i === 0 ? "first-result" : undefined} key={nanoid()} notebook={n} src={src} />
))}
</List.Section>
</List>
);
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/ManageBatchChangesCommand.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActionPanel, List, Action, Icon, useNavigation, Toast, Image, Color, showToast, Form } from "@raycast/api";
import { getProgressIcon } from "@raycast/utils";
import { useState, Fragment, useMemo, useEffect } from "react";
import { useState, useMemo, useEffect } from "react";
import { DateTime } from "luxon";
import { nanoid } from "nanoid";

Expand Down Expand Up @@ -57,10 +57,10 @@ export default function ManageBatchChanges({ src }: { src: Sourcegraph }) {
isLoading={loading}
searchBarPlaceholder={`Manage batch changes on ${srcName}`}
onSearchTextChange={setSearchText}
enableFiltering={true}
filtering={true}
selectedItemId={showSuggestions ? "first-result" : undefined}
>
{showSuggestions ? (
{showSuggestions && (
<List.Section title={"Suggestions"}>
<List.Item
title="Create a batch change"
Expand All @@ -72,8 +72,6 @@ export default function ManageBatchChanges({ src }: { src: Sourcegraph }) {
}
/>
</List.Section>
) : (
<Fragment />
)}

<List.Section title={"Batch changes"}>
Expand Down
2 changes: 1 addition & 1 deletion src/findNotebooksInstance.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FindNotebooksCommand from "./components/FindNotebooksCommand";
import InstanceCommand from "./components/InstanceCommand";

export default async function FindNotebooksInstance() {
export default function FindNotebooksInstance() {
return <InstanceCommand Command={FindNotebooksCommand} />;
}

0 comments on commit a8d895f

Please sign in to comment.