-
Notifications
You must be signed in to change notification settings - Fork 1
first commit for create issue Template UI #4
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
base: main
Are you sure you want to change the base?
Changes from all commits
2f4c508
08e7c0e
a028115
ca11368
3586749
62c968d
7a7f211
69db1cf
1203893
34c0520
72fa465
0d7c7f7
ece0da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <template> | ||
| <v-card :variant="props.variant ?? 'outlined'" :color="props.color" class="my-2 me-10"> | ||
| <div v-if="!editMode" class="d-flex align-center justify-space-between"> | ||
| <div class="d-flex align-center flex-grow-1 overflow-hidden"> | ||
| <v-icon v-if="props.prependIcon" class="ms-2" size="small">{{ props.prependIcon }}</v-icon> | ||
| <div class="text-h8 font-weight-medium mx-2 text-truncate"> | ||
| {{ props.content }} | ||
| </div> | ||
| </div> | ||
| <div class="d-flex align-center flex-shrink-0 ms-2"> | ||
| <IconButton v-if="props.editable" @click="toggleEditMode"> | ||
| <v-icon>mdi-pencil</v-icon> | ||
| </IconButton> | ||
| <IconButton color="error" class="me-1" @click="emit('delete')"> | ||
| <v-icon>mdi-delete</v-icon> | ||
| </IconButton> | ||
| </div> | ||
| </div> | ||
| <div v-else class="d-flex align-center"> | ||
| <v-text-field v-model="localContent" class="ma-2" hide-details density="compact" /> | ||
| <div class="d-flex justify-end"> | ||
| <v-btn | ||
| v-if="props.editable" | ||
| class="me-1" | ||
| @click=" | ||
| () => { | ||
| toggleEditMode(); | ||
| localContent = props.content; | ||
| } | ||
| " | ||
| >Cancel</v-btn | ||
| > | ||
| <v-btn | ||
| class="mx-1" | ||
| @click=" | ||
| () => { | ||
| emit('confirm', { content: localContent }); | ||
| toggleEditMode(); | ||
| } | ||
| " | ||
| >Confirm</v-btn | ||
| > | ||
| </div> | ||
| </div> | ||
| </v-card> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ref, watch } from "vue"; | ||
|
|
||
| const props = withDefaults( | ||
| defineProps<{ | ||
| content: string; | ||
| color?: string; | ||
| editable?: boolean; | ||
| variant?: "flat" | "text" | "elevated" | "tonal" | "outlined" | "plain"; | ||
| prependIcon?: string; | ||
| }>(), | ||
| { | ||
| editable: true | ||
| } | ||
| ); | ||
|
|
||
| const emit = defineEmits<{ | ||
| (e: "delete"): void; | ||
| (e: "confirm", payload: { content: string }): void; | ||
| }>(); | ||
|
|
||
| const editMode = ref(false); | ||
| const localContent = ref<string>(props.content); | ||
|
|
||
| watch( | ||
| () => props.content, | ||
| (newContent) => { | ||
| localContent.value = newContent; | ||
| } | ||
| ); | ||
|
|
||
| function toggleEditMode() { | ||
| editMode.value = !editMode.value; | ||
| } | ||
| </script> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| <template> | ||
| <v-card variant="outlined" class="my-4" :class="{ 'opacity-60': props.editable === false }"> | ||
| <div v-if="!isExpanded" class="d-flex align-center justify-space-between"> | ||
| <slot name="previewLeft" /> | ||
|
|
||
| <div class="d-flex align-center flex-grow-1 overflow-hidden"> | ||
| <div class="text-h6 font-weight-medium ma-2 text-truncate"> | ||
| {{ props.name }} | ||
| </div> | ||
| </div> | ||
|
|
||
| <slot name="previewRight" /> | ||
|
|
||
| <div class="d-flex align-center flex-shrink-0 ms-2"> | ||
| <IconButton :disabled="!props.editable" @click="emit('expand')"> | ||
| <v-icon>mdi-pencil</v-icon> | ||
| </IconButton> | ||
| <IconButton :disabled="!props.editable" color="error" class="me-1" @click="emit('delete')"> | ||
| <v-icon>mdi-delete</v-icon> | ||
| </IconButton> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div v-else class="mt-2"> | ||
| <v-text-field | ||
| class="mx-2 mb-2" | ||
| label="Name" | ||
| v-model="localName" | ||
| density="compact" | ||
| :error="!!props.nameErrorMessage" | ||
| :error-messages="props.nameErrorMessage" | ||
| /> | ||
| <v-textarea | ||
| v-if="props.description !== undefined" | ||
| class="mx-2" | ||
| label="Description" | ||
| v-model="localDescription" | ||
| auto-grow | ||
| rows="1" | ||
| max-rows="2" | ||
| density="compact" | ||
| /> | ||
|
|
||
| <slot name="extra" /> | ||
|
|
||
| <div class="d-flex justify-end ga-1"> | ||
| <v-btn class="mb-2" @click="emit('cancel')">Cancel</v-btn> | ||
| <v-btn class="me-2" @click="emit('confirm', { name: localName, description: localDescription })"> | ||
| Confirm | ||
| </v-btn> | ||
| </div> | ||
| </div> | ||
| </v-card> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ref, computed, watch } from "vue"; | ||
|
|
||
| type ExpandedKey = { | ||
| nameID: string; | ||
| type: string; | ||
| } | null; | ||
|
Comment on lines
+59
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
The Proposed fix: add an explicit `id` prop const props = withDefaults(
defineProps<{
+ id: string;
name: string;
description?: string;
expandedCardKey: ExpandedKey;
type: string;
nameErrorMessage?: string;
editable?: boolean;
}>(),
{
editable: true
}
);
const isExpanded = computed(
- () => props.editable && props.expandedCardKey?.type === props.type && props.expandedCardKey?.nameID === props.name
+ () => props.editable && props.expandedCardKey?.type === props.type && props.expandedCardKey?.nameID === props.id
);Also applies to: 85-87 🤖 Prompt for AI Agents |
||
|
|
||
| const props = withDefaults( | ||
| defineProps<{ | ||
| name: string; | ||
| description?: string; | ||
| expandedCardKey: ExpandedKey; | ||
| type: string; | ||
| nameErrorMessage?: string; | ||
| editable?: boolean; | ||
| }>(), | ||
| { | ||
| editable: true | ||
| } | ||
| ); | ||
|
|
||
| const emit = defineEmits<{ | ||
| (e: "expand"): void; | ||
| (e: "cancel"): void; | ||
| (e: "confirm", payload: { name: string; description: string }): void; | ||
| (e: "delete"): void; | ||
| }>(); | ||
|
|
||
| const isExpanded = computed( | ||
| () => props.editable && props.expandedCardKey?.type === props.type && props.expandedCardKey?.nameID === props.name | ||
| ); | ||
|
|
||
| const localName = ref(props.name); | ||
| const localDescription = ref(props.description ?? ""); | ||
|
|
||
| watch( | ||
| () => props.expandedCardKey, | ||
| () => { | ||
| if (isExpanded.value) { | ||
| localName.value = props.name; | ||
| localDescription.value = props.description ?? ""; | ||
| } | ||
| } | ||
| ); | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <template> | ||
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="32" height="32"> | ||
| <path :d="normalizedPath" /> | ||
| </svg> | ||
| </template> | ||
|
|
||
| <script lang="ts" setup> | ||
| import { computed } from "vue"; | ||
|
|
||
| const props = defineProps<{ path: string }>(); | ||
|
|
||
| const normalizedPath = computed(() => props.path.trim().replace(/"/g, "")); | ||
| </script> |
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.
confirmalways emitsdescription: ""even when the description field is hidden.When
props.descriptionisundefined, the textarea is not rendered (line 34), but theconfirmevent still includesdescription: localDescriptionwhich defaults to"". Consumers may misinterpret this as the user intentionally clearing the description. Consider emittingdescription: undefinedwhen description wasn't provided.Also applies to: 48-48
🤖 Prompt for AI Agents