@@ -3,7 +3,7 @@ import * as ContextMenu from '@/components/ui/shadcn/context-menu'
33import { useApp , useMathNotebook } from ' @/composables'
44import { i18n } from ' @/electron'
55import { format } from ' date-fns'
6- import { FileText , Plus } from ' lucide-vue-next'
6+ import { FileText } from ' lucide-vue-next'
77
88const { isCompactListMode } = useApp ()
99const {
@@ -49,87 +49,73 @@ function finishRename(id: string) {
4949function cancelRename() {
5050 editingId .value = null
5151}
52+
53+ defineExpose ({
54+ handleCreateSheet ,
55+ })
5256 </script >
5357
5458<template >
5559 <div class =" flex h-full flex-col overflow-hidden" >
56- <div class =" _mt-1 flex items-center justify-between px-2 pb-2 select-none" >
57- <UiText
58- as =" div"
59- variant =" caption"
60- weight =" bold"
61- uppercase
62- >
63- {{ i18n.t("spaces.math.sheetList") }}
64- </UiText >
65- <UiActionButton
66- :tooltip =" i18n.t('spaces.math.newSheet')"
67- @click =" handleCreateSheet"
68- >
69- <Plus class =" h-4 w-4" />
70- </UiActionButton >
71- </div >
72-
7360 <div class =" scrollbar min-h-0 flex-1 overflow-y-auto px-2" >
7461 <ContextMenu .ContextMenu
7562 v-for =" sheet in sheets"
7663 :key =" sheet.id"
7764 >
7865 <ContextMenu .ContextMenuTrigger as-child >
79- <div
80- class =" group mb-0.5 flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-75"
81- :class ="
82- activeSheetId === sheet.id
83- ? 'bg-accent text-accent-foreground'
84- : 'hover:bg-accent-hover'
85- "
66+ <SidebarItem
67+ class =" group mb-0.5 cursor-default transition-colors duration-75"
68+ :class =" activeSheetId === sheet.id ? 'text-accent-foreground' : ''"
69+ :selected =" activeSheetId === sheet.id"
8670 @click =" selectSheet(sheet.id)"
8771 @dblclick =" startRename(sheet.id, sheet.name)"
8872 >
89- <FileText
90- class =" h-3.5 w-3.5 shrink-0 transition-colors"
91- :class ="
92- activeSheetId === sheet.id
93- ? 'text-accent-foreground'
94- : 'text-muted-foreground'
95- "
96- :stroke-width =" 1.5"
97- />
98- <div class =" min-w-0 flex-1" >
99- <input
100- v-if =" editingId === sheet.id"
101- v-model =" editingName"
102- class =" sheet-rename-input w-full bg-transparent text-[13px] outline-none"
103- @blur =" finishRename(sheet.id)"
104- @keydown.enter =" finishRename(sheet.id)"
105- @keydown.escape =" cancelRename"
106- @click.stop
107- >
108- <template v-else >
109- <div
110- :class =" isCompactListMode ? 'flex items-center gap-2' : ''"
73+ <div class =" flex items-center gap-2 px-2 py-0.5" >
74+ <FileText
75+ class =" h-3.5 w-3.5 shrink-0 transition-colors"
76+ :class ="
77+ activeSheetId === sheet.id
78+ ? 'text-accent-foreground'
79+ : 'text-muted-foreground'
80+ "
81+ :stroke-width =" 1.5"
82+ />
83+ <div class =" min-w-0 flex-1" >
84+ <input
85+ v-if =" editingId === sheet.id"
86+ v-model =" editingName"
87+ class =" sheet-rename-input w-full bg-transparent text-[13px] outline-none"
88+ @blur =" finishRename(sheet.id)"
89+ @keydown.enter =" finishRename(sheet.id)"
90+ @keydown.escape =" cancelRename"
91+ @click.stop
11192 >
112- <UiText
113- as =" div"
114- variant =" sm"
115- class =" truncate leading-tight"
116- :class =" isCompactListMode ? 'flex-1' : ''"
117- >
118- {{ sheet.name }}
119- </UiText >
120- <UiText
121- as =" div"
122- variant =" caption"
123- class =" leading-tight transition-colors"
124- :class =" isCompactListMode ? 'shrink-0' : ''"
125- muted
93+ <template v-else >
94+ <div
95+ :class =" isCompactListMode ? 'flex items-center gap-2' : ''"
12696 >
127- {{ format(new Date(sheet.updatedAt), "dd.MM.yyyy") }}
128- </UiText >
129- </div >
130- </template >
97+ <UiText
98+ as =" div"
99+ variant =" sm"
100+ class =" truncate leading-tight"
101+ :class =" isCompactListMode ? 'flex-1' : ''"
102+ >
103+ {{ sheet.name }}
104+ </UiText >
105+ <UiText
106+ as =" div"
107+ variant =" caption"
108+ class =" leading-tight transition-colors"
109+ :class =" isCompactListMode ? 'shrink-0' : ''"
110+ muted
111+ >
112+ {{ format(new Date(sheet.updatedAt), "dd.MM.yyyy") }}
113+ </UiText >
114+ </div >
115+ </template >
116+ </div >
131117 </div >
132- </div >
118+ </SidebarItem >
133119 </ContextMenu .ContextMenuTrigger >
134120
135121 <ContextMenu .ContextMenuContent >
0 commit comments