-
Notifications
You must be signed in to change notification settings - Fork 477
Modal Standardization #4784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Modal Standardization #4784
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d149deb
[feature] showLayoutDialog added & types modified
viva-jinyi ad89567
[feature] Add model selector dialog integration and custom component …
viva-jinyi 5b82b90
[refactor] apply code reviews
viva-jinyi ec30a80
feature: useCoreCommand added
viva-jinyi c0029dd
Update locales [skip ci]
invalid-email-address dce3d09
[refactor] Improve modal dialog components based on PR feedback
viva-jinyi fd1494d
[feature] Add right panel support and improve modal transitions
viva-jinyi 80bffb2
style: background color modified
viva-jinyi cbcf108
style: color token modified
viva-jinyi 30925a3
style: color modified
viva-jinyi 2452efc
Update locales [skip ci]
invalid-email-address 394fd96
fix: code review
viva-jinyi e0cbb79
fix: lodash to es-toolkit
viva-jinyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[feature] Add model selector dialog integration and custom component …
…types
- Loading branch information
commit ad89567b36a3ba57f25c974c6f6174f0a7461493
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <template> | ||
| <button | ||
| class="flex justify-center items-center outline-none border-none p-0 bg-white text-neutral-950 dark-theme:bg-neutral-700 dark-theme:text-white w-8 h-8 rounded-lg cursor-pointer" | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @click="onClick" | ||
| > | ||
| <slot></slot> | ||
| </button> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| const { onClick } = defineProps<{ | ||
| onClick: () => void | ||
| }>() | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| <template> | ||
| <BaseWidgetLayout> | ||
| <template #leftPanel> | ||
| <LeftSidePanel :nav-items="temp_navigation"> | ||
| <template #header-icon> | ||
| <i-lucide:puzzle class="text-neutral" /> | ||
| </template> | ||
| <template #header-title> | ||
| <span class="text-neutral text-base">{{ t('g.title') }}</span> | ||
| </template> | ||
| </LeftSidePanel> | ||
| </template> | ||
|
|
||
| <template #header> | ||
| <!-- here --> | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </template> | ||
|
|
||
| <template #content> | ||
| <!-- here --> | ||
| </template> | ||
|
|
||
| <template #rightPanel> | ||
| <RightSidePanel></RightSidePanel> | ||
| </template> | ||
| </BaseWidgetLayout> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { provide, ref } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
| import { NavGroupData, NavItemData } from '@/types/custom_components/navTypes' | ||
| import { OnCloseKey } from '@/types/custom_components/widgetTypes' | ||
| import BaseWidgetLayout from './layout/BaseWidgetLayout.vue' | ||
| import RightSidePanel from './panel/RightSidePanel.vue' | ||
| const { t } = useI18n() | ||
| const { onClose } = defineProps<{ | ||
| onClose: () => void | ||
| }>() | ||
| provide(OnCloseKey, onClose) | ||
| const temp_navigation = ref<(NavItemData | NavGroupData)[]>([ | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { id: 'installed', label: 'Installed' }, | ||
| { | ||
| title: 'TAGS', | ||
| items: [ | ||
| { id: 'tag-sd15', label: 'SD 1.5' }, | ||
| { id: 'tag-sdxl', label: 'SDXL' }, | ||
| { id: 'tag-utility', label: 'Utility' } | ||
| ] | ||
| }, | ||
| { | ||
| title: 'CATEGORIES', | ||
| items: [ | ||
| { id: 'cat-models', label: 'Models' }, | ||
| { id: 'cat-nodes', label: 'Nodes' } | ||
| ] | ||
| } | ||
| ]) | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <template> | ||
| <div class="base-widget-layout rounded-2xl overflow-hidden relative"> | ||
| <IconButton class="absolute top-4 right-6" @click="closeDialog"> | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <i class="pi pi-times text-sm"></i> | ||
| </IconButton> | ||
| <div class="flex w-full h-full"> | ||
| <nav v-if="$slots.leftPanel"> | ||
| <slot name="leftPanel"></slot> | ||
| </nav> | ||
|
|
||
| <div class="flex-1 flex bg-neutral-50 dark-theme:bg-neutral-900"> | ||
| <div class="flex-1 flex flex-col"> | ||
| <header v-if="$slots.header" class="w-full h-16 px-6 py-4"> | ||
| <slot name="header"> </slot> | ||
| </header> | ||
| <main class="flex-1"> | ||
| <slot name="content"></slot> | ||
| </main> | ||
| </div> | ||
|
|
||
| <!-- <aside v-if="$slots.rightPanel"> | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <slot name="rightPanel"></slot> | ||
| </aside> --> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { inject } from 'vue' | ||
| import { OnCloseKey } from '@/types/custom_components/widgetTypes' | ||
| const closeDialog = inject(OnCloseKey, () => {}) | ||
| </script> | ||
| <style scoped> | ||
| .base-widget-layout { | ||
| height: 80vh; | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| width: 90vw; | ||
| max-width: 1280px; | ||
| aspect-ratio: 20/13; | ||
| } | ||
| @media (min-width: 1450px) { | ||
| .base-widget-layout { | ||
| max-width: 1724px; | ||
| } | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <template> | ||
| <div | ||
| class="flex items-center gap-2 px-4 py-2 text-xs rounded-md transition-colors cursor-pointer" | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :class=" | ||
| active | ||
| ? 'bg-neutral-100 dark-theme:bg-neutral-600 text-neutral' | ||
| : 'text-neutral hover:bg-neutral-50 hover:dark-theme:bg-neutral-700' | ||
| " | ||
| > | ||
| <i-lucide:folder class="text-xs text-neutral" /> | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <span> | ||
| <slot></slot> | ||
| </span> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| defineProps<{ | ||
| active?: boolean | ||
| }>() | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <template> | ||
| <h3 | ||
| class="m-0 px-3 py-0 pt-5 text-sm font-bold uppercase text-neutral-400 dark-theme:text-neutral-400" | ||
| > | ||
| {{ title }} | ||
| </h3> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| const { title } = defineProps<{ | ||
| title: string | ||
| }>() | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <template> | ||
| <div class="flex flex-col h-full w-56 bg-white dark-theme:bg-neutral-800"> | ||
| <PanelHeader> | ||
| <template #icon> | ||
| <slot name="header-icon"></slot> | ||
| </template> | ||
| <slot name="header-title"></slot> | ||
| </PanelHeader> | ||
|
|
||
| <nav class="flex-1 px-3 py-4 flex flex-col gap-2"> | ||
| <template v-for="(item, index) in navItems" :key="index"> | ||
| <div v-if="'items' in item" class="flex flex-col gap-2"> | ||
| <NavTitle :title="item.title" /> | ||
| <NavItem | ||
| v-for="subItem in item.items" | ||
| :key="subItem.id" | ||
| :active="activeItem === subItem.id" | ||
| @click="activeItem = subItem.id" | ||
| > | ||
| {{ subItem.label }} | ||
| </NavItem> | ||
| </div> | ||
| <div v-else class="flex flex-col gap-2"> | ||
| <NavItem | ||
| :active="activeItem === item.id" | ||
| @click="activeItem = item.id" | ||
| > | ||
| {{ item.label }} | ||
| </NavItem> | ||
| </div> | ||
| </template> | ||
| </nav> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ref } from 'vue' | ||
| import { NavGroupData, NavItemData } from '@/types/custom_components/navTypes' | ||
| import NavItem from '../nav/NavItem.vue' | ||
| import NavTitle from '../nav/NavTitle.vue' | ||
| import PanelHeader from './PanelHeader.vue' | ||
| const { navItems = [] } = defineProps<{ | ||
| navItems: (NavItemData | NavGroupData)[] | ||
| }>() | ||
| const getFirstItemId = () => { | ||
| if (!navItems || navItems.length === 0) { | ||
| return null | ||
| } | ||
| const firstEntry = navItems[0] | ||
| if ('items' in firstEntry && firstEntry.items.length > 0) { | ||
| return firstEntry.items[0].id | ||
| } | ||
| if ('id' in firstEntry) { | ||
| return firstEntry.id | ||
| } | ||
| return null // 해당하는 아이템이 없는 경우 | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| const activeItem = ref(getFirstItemId()) | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <template> | ||
| <header class="flex items-center justify-between h-16 px-6"> | ||
| <div class="flex items-center gap-2 pl-1"> | ||
| <slot name="icon"> | ||
| <i-lucide:puzzle class="text-neutral text-base" /> | ||
| </slot> | ||
| <h2 class="font-bold text-base text-neutral"> | ||
| <slot></slot> | ||
| </h2> | ||
| </div> | ||
| </header> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <template> | ||
| <div class="w-80 h-full pl-4 pr-6 pb-8 bg-white dark-theme:bg-neutral-800"> | ||
| <slot></slot> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"></script> | ||
viva-jinyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import ModelSelector from '@/components/custom/widget/ModelSelector.vue' | ||
| import { useDialogService } from '@/services/dialogService' | ||
| import { useDialogStore } from '@/stores/dialogStore' | ||
|
|
||
| const DIALOG_KEY = 'global-model-selector' | ||
|
|
||
| export const useModelSelectorDialog = () => { | ||
| const dialogService = useDialogService() | ||
| const dialogStore = useDialogStore() | ||
|
|
||
| function hide() { | ||
| dialogStore.closeDialog({ key: DIALOG_KEY }) | ||
| } | ||
|
|
||
| function show() { | ||
| dialogService.showLayoutDialog({ | ||
| key: DIALOG_KEY, | ||
| component: ModelSelector, | ||
| props: { | ||
| onClose: hide | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| return { | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| show | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './navTypes' | ||
| export * from './widgetTypes' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export interface NavItemData { | ||
| id: string | ||
| label: string | ||
| } | ||
|
|
||
| export interface NavGroupData { | ||
| title: string | ||
| items: NavItemData[] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { InjectionKey } from 'vue' | ||
|
|
||
| export const OnCloseKey: InjectionKey<() => void> = Symbol() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.