Skip to content

Commit 2961b2d

Browse files
authored
feat(config): added color picker
1 parent c0ed431 commit 2961b2d

File tree

9 files changed

+408
-139
lines changed

9 files changed

+408
-139
lines changed

app/components/AppFooter.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
<template>
44
<footer class="footer w-full text-center py-4">
5-
<p class="flex items-center align-middle justify-center text-stone-800 dark:text-white text-sm justify-center gap-2">
6-
Made by <a
5+
<p class="flex items-center justify-center text-stone-800 dark:text-white text-sm gap-2">
6+
<span>Made by <a
77
href="https://heristop.github.io/about"
88
target="_blank"
99
class="text-stone-700 dark:text-stone-400 hover:text-stone-400 dark:hover:text-stone-500 transition-colors duration-300 font-bold"
10-
>heristop</a> <span class="text-3xl front-bold">·</span> <span class="ml-1">Deployed on NuxtHub</span>
10+
>heristop</a></span>
11+
<span class="text-3xl font-bold">·</span>
12+
<span>Deployed on NuxtHub</span>
1113
</p>
1214
</footer>
1315
</template>

app/components/EditableLabel.vue

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,50 @@
11
<script setup lang="ts">
2-
import { ref, onMounted, nextTick } from 'vue'
2+
import { ref, watch } from 'vue'
33
44
const props = defineProps<{
55
value: string
66
isEditing: boolean
7+
isEditMode: boolean
78
}>()
89
910
const emit = defineEmits<{
1011
(e: 'update:value', value: string): void
1112
(e: 'update:isEditing', value: boolean): void
13+
(e: 'double-click'): void
1214
}>()
1315
1416
const inputRef = ref<HTMLInputElement | null>(null)
1517
const inputValue = ref(props.value)
1618
17-
onMounted(() => {
18-
if (props.isEditing) {
19-
nextTick(() => {
19+
watch(() => props.isEditing, (newValue) => {
20+
if (newValue) {
21+
setTimeout(() => {
2022
inputRef.value?.focus()
2123
inputRef.value?.select()
2224
})
2325
}
2426
})
2527
28+
watch(() => props.value, (newValue) => {
29+
inputValue.value = newValue
30+
})
31+
2632
const finishEditing = () => {
2733
emit('update:value', inputValue.value)
2834
emit('update:isEditing', false)
2935
}
36+
37+
const cancelEditing = () => {
38+
inputValue.value = props.value
39+
emit('update:isEditing', false)
40+
}
41+
42+
const handleDoubleClick = (event: MouseEvent) => {
43+
if (!props.isEditMode) {
44+
event.stopPropagation()
45+
emit('double-click')
46+
}
47+
}
3048
</script>
3149

3250
<template>
@@ -37,42 +55,13 @@ const finishEditing = () => {
3755
class="edit-input"
3856
@blur="finishEditing"
3957
@keyup.enter="finishEditing"
40-
@keyup.esc="finishEditing"
41-
@dbclick="finishEditing"
58+
@keyup.esc="cancelEditing"
4259
>
4360
<span
4461
v-else
4562
class="node-text cursor-text"
46-
@click="$emit('update:isEditing', true)"
63+
@dblclick="handleDoubleClick"
4764
>
4865
{{ value }}
4966
</span>
5067
</template>
51-
52-
<style scoped>
53-
.edit-input {
54-
text-align: center;
55-
background: rgba(255, 255, 255, 0.1);
56-
border: none;
57-
border-bottom: 1px solid white;
58-
color: white;
59-
outline: none;
60-
transition: all 0.3s;
61-
padding: 2px 4px;
62-
border-radius: 2px;
63-
}
64-
65-
.edit-input:focus {
66-
background: rgba(255, 255, 255, 0.2);
67-
border-bottom: 2px solid white;
68-
outline: none;
69-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
70-
}
71-
72-
.node-text {
73-
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
74-
max-width: 100%;
75-
overflow: hidden;
76-
text-overflow: ellipsis;
77-
}
78-
</style>

app/components/ProjectPanel.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ onMounted(() => {
506506
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"
507507
>
508508
<div class="bg-white dark:bg-stone-800 p-6 rounded-lg shadow-xl w-full max-w-lg relative">
509-
<!-- Bouton pour fermer la modale -->
510509
<button
511510
class="absolute top-4 right-4 text-stone-400 hover:text-stone-600 dark:text-stone-300 dark:hover:text-white transition-colors duration-300"
512511
aria-label="Close Modal"

app/components/TreeNode.vue

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ const displayContent = computed({
3737
},
3838
})
3939
40+
const isDraggable = computed(() => !store.isEditingMode && !isEditing.value)
41+
4042
const handleLabelUpdate = (newValue: string) => {
4143
displayContent.value = newValue
44+
isEditing.value = false
4245
}
4346
4447
watch(() => store.displayLabel, () => {
@@ -97,6 +100,12 @@ const getUniqueKeyName = (base: string, type: 'key' | 'name') => {
97100
return newName
98101
}
99102
103+
const handleLabelDoubleClick = () => {
104+
if (!store.isEditingMode) {
105+
isEditing.value = true
106+
}
107+
}
108+
100109
const addChildNode = (event: MouseEvent) => {
101110
event.stopPropagation()
102111
@@ -142,6 +151,11 @@ const deleteNode = (event: MouseEvent) => {
142151
}
143152
144153
const handleDragStart = (event: DragEvent) => {
154+
if (!isDraggable.value) {
155+
event.preventDefault()
156+
return
157+
}
158+
145159
if (isDragging.value) {
146160
return
147161
}
@@ -151,6 +165,11 @@ const handleDragStart = (event: DragEvent) => {
151165
}
152166
153167
const handleDrop = (event: DragEvent) => {
168+
if (store.isEditingMode) {
169+
event.preventDefault()
170+
return
171+
}
172+
154173
event.preventDefault()
155174
event.stopPropagation()
156175
const draggedKey = event.dataTransfer?.getData('text/plain')
@@ -161,22 +180,15 @@ const handleDrop = (event: DragEvent) => {
161180
}
162181
163182
const handleDragOver = (event: DragEvent) => {
164-
event.preventDefault()
183+
if (!store.isEditingMode) {
184+
event.preventDefault()
185+
}
165186
}
166187
167188
const handleTitleClick = (event: MouseEvent) => {
168189
event.stopPropagation()
169190
}
170191
171-
watch(() => [props.node.status, store.statuses], () => {
172-
nodeStatus.value = props.node.status || store.statuses[0]?.name || ''
173-
checkIfSuccessNode(props.node)
174-
}, { immediate: true })
175-
176-
onMounted(() => {
177-
updateParentStatus()
178-
})
179-
180192
const nodeStyle = computed(() => {
181193
const baseFlex = 1
182194
const childCount = props.node.children ? props.node.children.length : 0
@@ -193,7 +205,6 @@ const handleClick = (event: MouseEvent) => {
193205
194206
if (!props.node.children || !props.node.children.length) {
195207
updateStatus()
196-
197208
return
198209
}
199210
}
@@ -232,6 +243,15 @@ const applySuccessAnimation = (node: Section) => {
232243
applyToParents(node)
233244
isSuccessNode.value = true
234245
}
246+
247+
watch(() => [props.node.status, store.statuses], () => {
248+
nodeStatus.value = props.node.status || store.statuses[0]?.name || ''
249+
checkIfSuccessNode(props.node)
250+
}, { immediate: true })
251+
252+
onMounted(() => {
253+
updateParentStatus()
254+
})
235255
</script>
236256

237257
<template>
@@ -240,7 +260,7 @@ const applySuccessAnimation = (node: Section) => {
240260
:class="{ 'success-animation': isSuccessNode }"
241261
:style="nodeStyle"
242262
:data-node-key="node.key"
243-
:draggable="!store.isEditingMode && !isEditing"
263+
:draggable="isDraggable"
244264
@dragstart="handleDragStart"
245265
@drop="handleDrop"
246266
@dragover="handleDragOver"
@@ -295,12 +315,12 @@ const applySuccessAnimation = (node: Section) => {
295315
</span>
296316

297317
<EditableLabel
298-
:key="store.displayLabel"
299318
:value="displayContent"
300319
:is-editing="isEditing"
301-
class="truncate dark:text-stone-100"
320+
:is-edit-mode="store.isEditingMode"
302321
@update:value="handleLabelUpdate"
303322
@update:is-editing="isEditing = $event"
323+
@double-click="handleLabelDoubleClick"
304324
/>
305325

306326
<div

0 commit comments

Comments
 (0)