Fix dead code, isEditing guard, and empty state condition
- Remove unused hashCode function from markdown-text.tsx (leftover from removed artifacts feature) - Include editing state in isEditing check so Cancel button stays visible when user clears name/content fields while editing an existing prompt - Fix empty state message to only show when no items exist in any section (pinned, folders, or unfiled), not just when filteredItems is empty
This commit is contained in:
parent
24507dc185
commit
392c59bdc9
3 changed files with 2 additions and 11 deletions
|
|
@ -50,15 +50,6 @@ type CodeFence = {
|
|||
source: string;
|
||||
};
|
||||
|
||||
function hashCode(str: string): string {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash + char) | 0;
|
||||
}
|
||||
return Math.abs(hash).toString(36);
|
||||
}
|
||||
|
||||
function getMermaidSource(blockContent: string): string | null {
|
||||
const source = blockContent.match(MERMAID_SOURCE_RE)?.[1]?.trim();
|
||||
return source && source.length > 0 ? source : null;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export const PromptLibrarySheet: FC<{
|
|||
);
|
||||
|
||||
const items = prompts ?? [];
|
||||
const isEditing = name !== "" || content !== "";
|
||||
const isEditing = editing !== null || name !== "" || content !== "";
|
||||
|
||||
return (
|
||||
<Sheet open={open} onOpenChange={onOpenChange}>
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ export function ThreadSidebar({
|
|||
<SidebarMenu>
|
||||
{unfiledItems.map(renderItem)}
|
||||
</SidebarMenu>
|
||||
{filteredItems.length === 0 && (
|
||||
{unfiledItems.length === 0 && pinnedItems.length === 0 && folderedItems.size === 0 && (
|
||||
<p className="px-2 py-6 text-center text-xs text-muted-foreground">
|
||||
{debouncedQuery.trim() ? "No matching threads" : "No threads yet"}
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue