Line data Source code
1 : <template>
2 0 : <BaseModalLayout
3 : :labels="modalLayoutLabels"
4 : :content-title="$t('assetBrowser.checkpoints')"
5 : @close="onClose"
6 : >
7 : <template #leftPanel>
8 : <LeftSidePanel v-model="selectedNavItem" :nav-items="tempNavigation">
9 : <template #header-icon>
10 : <i class="icon-[lucide--puzzle] text-foreground" />
11 : </template>
12 : <template #header-title>
13 : <span class="text-base text-foreground">{{ $t('g.title') }}</span>
14 : </template>
15 : </LeftSidePanel>
16 : </template>
17 :
18 : <template #header>
19 : <SearchInput
20 : v-model="searchQuery"
21 : :clear-label="$t('g.clear')"
22 : :placeholder="$t('g.searchPlaceholder', { subject: '' })"
23 : :accessible-label="$t('g.search')"
24 : size="lg"
25 : class="max-w-96 flex-1"
26 : />
27 : </template>
28 :
29 : <template #header-right-area>
30 : <div class="flex gap-2">
31 : <Button variant="primary" @click="() => {}">
32 : <i class="icon-[lucide--upload]" />
33 : <span>{{ $t('g.upload') }}</span>
34 : </Button>
35 : <Menu :items="moreMenuItems" align="end">
36 : <template #trigger>
37 : <Button
38 : size="icon"
39 : variant="secondary"
40 : icon="icon-[lucide--ellipsis]"
41 : :aria-label="$t('g.more')"
42 : />
43 : </template>
44 : </Menu>
45 : </div>
46 : </template>
47 :
48 : <template #contentFilter>
49 : <div class="relative flex gap-2 px-6 pb-4">
50 : <AppMultiSelect
51 : v-model="selectedFrameworks"
52 : v-model:search-query="searchText"
53 : class="w-[250px]"
54 : :label="$t('assetBrowser.selectFrameworks')"
55 : :options="frameworkOptions"
56 : :show-search-box="true"
57 : :show-selected-count="true"
58 : :show-clear-button="true"
59 : />
60 : <AppMultiSelect
61 : v-model="selectedProjects"
62 : :label="$t('assetBrowser.selectProjects')"
63 : :options="projectOptions"
64 : />
65 : <AppSingleSelect
66 : v-model="selectedSort"
67 : :label="$t('assetBrowser.sortingType')"
68 : :options="sortOptions"
69 : class="w-[135px]"
70 : >
71 : <template #icon>
72 : <i class="icon-[lucide--filter]" />
73 : </template>
74 : </AppSingleSelect>
75 : </div>
76 : </template>
77 :
78 : <template #content>
79 : <!-- Card Examples -->
80 : <div :style="gridStyle">
81 0 : <CardContainer v-for="i in 100" :key="i" size="regular">
82 : <template #top>
83 : <CardTop ratio="landscape">
84 : <template #default>
85 : <div class="size-full bg-blue-500"></div>
86 : </template>
87 : <template #top-right>
88 : <Button
89 : size="icon"
90 : class="bg-white! text-neutral-900!"
91 : @click="() => {}"
92 : >
93 : <i class="icon-[lucide--info]" />
94 : </Button>
95 : </template>
96 : <template #bottom-right>
97 : <Tag label="png" shape="overlay" />
98 : <Tag label="1.2 MB" shape="overlay" />
99 : <Tag label="LoRA" shape="overlay">
100 : <template #icon>
101 : <i class="icon-[lucide--folder]" />
102 : </template>
103 : </Tag>
104 : </template>
105 : </CardTop>
106 : </template>
107 : <template #bottom>
108 : <CardBottom></CardBottom>
109 : </template>
110 : </CardContainer>
111 : </div>
112 : </template>
113 :
114 : <template #rightPanel>
115 : <div class="size-full bg-card pr-6 pb-8 pl-4"></div>
116 : </template>
117 : </BaseModalLayout>
118 : </template>
119 :
120 : <script setup lang="ts">
121 : import { computed, ref } from 'vue'
122 : import { useI18n } from 'vue-i18n'
123 :
124 : import CardBottom from '@comfyorg/design-system/content-card/CardBottom'
125 : import CardContainer from '@comfyorg/design-system/content-card/CardContainer'
126 : import CardTop from '@comfyorg/design-system/content-card/CardTop'
127 : import Tag from '@comfyorg/design-system/chip/Tag'
128 : import Menu from '@comfyorg/design-system/menu/Menu'
129 : import type { MenuItem } from '@comfyorg/design-system/lib/menu/types'
130 : import SearchInput from '@comfyorg/design-system/search-input/SearchInput'
131 : import AppMultiSelect from '@/components/common/AppMultiSelect.vue'
132 : import AppSingleSelect from '@/components/common/AppSingleSelect.vue'
133 : import Button from '@comfyorg/design-system/button/Button'
134 : import BaseModalLayout from '@comfyorg/design-system/layout/BaseModalLayout'
135 : import LeftSidePanel from '@comfyorg/design-system/navigation/LeftSidePanel'
136 : import type {
137 : NavGroupData,
138 : NavItemData
139 : } from '@comfyorg/design-system/lib/navigation/types'
140 : import { useModalLayoutLabels } from '@/components/dialog/useModalLayoutLabels'
141 : import { createGridStyle } from '@/utils/gridUtil'
142 :
143 0 : const frameworkOptions = ref([
144 : { name: 'Vue', value: 'vue' },
145 : { name: 'React', value: 'react' },
146 : { name: 'Angular', value: 'angular' },
147 : { name: 'Svelte', value: 'svelte' }
148 : ])
149 :
150 0 : const projectOptions = ref([
151 : { name: 'Project A', value: 'proj-a' },
152 : { name: 'Project B', value: 'proj-b' },
153 : { name: 'Project C', value: 'proj-c' }
154 : ])
155 :
156 0 : const sortOptions = ref([
157 : { name: 'Popular', value: 'popular' },
158 : { name: 'Latest', value: 'latest' },
159 : { name: 'A → Z', value: 'az' }
160 : ])
161 :
162 0 : const tempNavigation = ref<(NavItemData | NavGroupData)[]>([
163 : { id: 'installed', label: 'Installed', icon: 'icon-[lucide--download]' },
164 : {
165 : title: 'TAGS',
166 : items: [
167 : { id: 'tag-sd15', label: 'SD 1.5', icon: 'icon-[lucide--tag]' },
168 : { id: 'tag-sdxl', label: 'SDXL', icon: 'icon-[lucide--tag]' },
169 : { id: 'tag-utility', label: 'Utility', icon: 'icon-[lucide--tag]' }
170 : ]
171 : },
172 : {
173 : title: 'CATEGORIES',
174 : items: [
175 : { id: 'cat-models', label: 'Models', icon: 'icon-[lucide--layers]' },
176 : { id: 'cat-nodes', label: 'Nodes', icon: 'icon-[lucide--grid-3x3]' }
177 : ]
178 : }
179 : ])
180 :
181 : const { onClose } = defineProps<{
182 : onClose: () => void
183 : }>()
184 0 : const { t } = useI18n()
185 :
186 0 : const moreMenuItems: MenuItem[] = [
187 : {
188 : label: () => t('g.settings'),
189 : icon: 'icon-[lucide--download]',
190 : command: () => {}
191 : },
192 : {
193 : label: () => t('g.profile'),
194 : icon: 'icon-[lucide--scroll]',
195 : command: () => {}
196 : }
197 : ]
198 :
199 0 : const modalLayoutLabels = useModalLayoutLabels()
200 :
201 0 : const searchQuery = ref<string>('')
202 0 : const searchText = ref<string>('')
203 0 : const selectedFrameworks = ref([])
204 0 : const selectedProjects = ref([])
205 0 : const selectedSort = ref<string>('popular')
206 :
207 0 : const selectedNavItem = ref<string | null>('installed')
208 :
209 0 : const gridStyle = computed(() => createGridStyle())
210 : </script>
|