-
Notifications
You must be signed in to change notification settings - Fork 512
App builder exit updates #9218
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
App builder exit updates #9218
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9a75076
- remove exit builder button from right panel
pythongosssss 0667977
tidy
pythongosssss 912b835
exit one scape
pythongosssss ab7b646
use standard button
pythongosssss e85d92e
guard escape key
pythongosssss c02bbdf
Remove confirmation from builder exit (#9286)
AustinMroz 8f47ed1
pr feedback
pythongosssss 84dff76
Merge remote-tracking branch 'origin/main' into pysssss/appmode-exit-…
pythongosssss 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
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
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,43 @@ | ||
| <template> | ||
| <div | ||
| class="fixed bottom-4 left-1/2 z-1000 flex -translate-x-1/2 items-center rounded-2xl border border-border-default bg-base-background p-2 shadow-interface" | ||
| > | ||
| <Button size="lg" @click="onExitBuilder"> | ||
| {{ t('builderMenu.exitAppBuilder') }} | ||
| </Button> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { useEventListener } from '@vueuse/core' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| import Button from '@/components/ui/button/Button.vue' | ||
| import { useAppMode } from '@/composables/useAppMode' | ||
| import { useAppModeStore } from '@/stores/appModeStore' | ||
| import { useDialogStore } from '@/stores/dialogStore' | ||
|
|
||
| const { t } = useI18n() | ||
| const appModeStore = useAppModeStore() | ||
| const dialogStore = useDialogStore() | ||
| const { isBuilderMode } = useAppMode() | ||
|
|
||
| useEventListener(window, 'keydown', (e: KeyboardEvent) => { | ||
| if ( | ||
| e.key === 'Escape' && | ||
| !e.ctrlKey && | ||
| !e.altKey && | ||
| !e.metaKey && | ||
| dialogStore.dialogStack.length === 0 && | ||
| isBuilderMode.value | ||
| ) { | ||
| e.preventDefault() | ||
| e.stopPropagation() | ||
| onExitBuilder() | ||
| } | ||
| }) | ||
|
|
||
| function onExitBuilder() { | ||
| void appModeStore.exitBuilder() | ||
| } | ||
| </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,73 @@ | ||
| <template> | ||
| <Popover :show-arrow="false" class="min-w-56 p-3"> | ||
| <template #button> | ||
| <button | ||
| :class=" | ||
| cn( | ||
| 'absolute left-4 top-[calc(var(--workflow-tabs-height)+16px)] z-1000 inline-flex h-10 cursor-pointer items-center gap-2.5 rounded-lg py-2 pr-2 pl-3 shadow-interface transition-colors border-none', | ||
| 'bg-secondary-background hover:bg-secondary-background-hover', | ||
| 'data-[state=open]:bg-secondary-background-hover' | ||
| ) | ||
| " | ||
| :aria-label="t('linearMode.appModeToolbar.appBuilder')" | ||
| > | ||
| <i class="icon-[lucide--hammer] size-4" /> | ||
| <span class="text-sm font-medium"> | ||
| {{ t('linearMode.appModeToolbar.appBuilder') }} | ||
| </span> | ||
pythongosssss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <i class="icon-[lucide--chevron-down] size-4 text-muted-foreground" /> | ||
| </button> | ||
| </template> | ||
| <template #default="{ close }"> | ||
| <button | ||
| :class=" | ||
| cn( | ||
| 'flex w-full items-center gap-3 rounded-md bg-transparent px-3 py-2 text-sm border-none', | ||
| hasOutputs | ||
| ? 'cursor-pointer hover:bg-secondary-background-hover' | ||
| : 'opacity-50 pointer-events-none' | ||
| ) | ||
| " | ||
| :disabled="!hasOutputs" | ||
| @click="onSave(close)" | ||
| > | ||
| <i class="icon-[lucide--save] size-4" /> | ||
| {{ t('builderMenu.saveApp') }} | ||
| </button> | ||
| <div class="my-1 border-t border-border-default" /> | ||
| <button | ||
| class="flex w-full cursor-pointer items-center gap-3 rounded-md bg-transparent px-3 py-2 text-sm border-none hover:bg-secondary-background-hover" | ||
| @click="onExitBuilder(close)" | ||
| > | ||
| <i class="icon-[lucide--square-pen] size-4" /> | ||
| {{ t('builderMenu.exitAppBuilder') }} | ||
| </button> | ||
| </template> | ||
| </Popover> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { storeToRefs } from 'pinia' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| import Popover from '@/components/ui/Popover.vue' | ||
| import { useAppModeStore } from '@/stores/appModeStore' | ||
| import { cn } from '@/utils/tailwindUtil' | ||
|
|
||
| import { useBuilderSave } from './useBuilderSave' | ||
|
|
||
| const { t } = useI18n() | ||
| const appModeStore = useAppModeStore() | ||
| const { hasOutputs } = storeToRefs(appModeStore) | ||
| const { setSaving } = useBuilderSave() | ||
|
|
||
| function onSave(close: () => void) { | ||
| setSaving(true) | ||
| close() | ||
| } | ||
|
|
||
| function onExitBuilder(close: () => void) { | ||
| void appModeStore.exitBuilder() | ||
| close() | ||
| } | ||
| </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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard Escape handling while editing text inputs
The global Escape handler exits builder mode even when focus is in editable fields. With direct exit behavior, this can cause accidental mode exits during text entry.
Suggested fix
useEventListener(window, 'keydown', (e: KeyboardEvent) => { + const target = e.target as HTMLElement | null + const isEditable = + target instanceof HTMLInputElement || + target instanceof HTMLTextAreaElement || + target?.isContentEditable === true + if (isEditable) return + if ( e.key === 'Escape' && !e.ctrlKey && !e.altKey && !e.metaKey && + !e.shiftKey && dialogStore.dialogStack.length === 0 && isBuilderMode.value ) {📝 Committable suggestion
🤖 Prompt for AI Agents