Skip to content

Commit f9ac822

Browse files
feat(ProjectCard): add copy path action
1 parent 6a30813 commit f9ac822

File tree

6 files changed

+69
-22
lines changed

6 files changed

+69
-22
lines changed

jetv-ui/icons/copy.svg

Lines changed: 8 additions & 0 deletions
Loading

jetv-ui/icons/copy_dark.svg

Lines changed: 8 additions & 0 deletions
Loading

jetv-ui/src/assets/jet-icons.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"prefix": "jet",
3-
"lastModified": 1756901070,
3+
"lastModified": 1758096806,
44
"icons": {
55
"add": {
66
"body": "<g fill=\"none\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7.5 1C7.77614 1 8 1.22386 8 1.5V7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H8V13.5C8 13.7761 7.77614 14 7.5 14C7.22386 14 7 13.7761 7 13.5V8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H7V1.5C7 1.22386 7.22386 1 7.5 1Z\" fill=\"#6C707E\"/></g>"
@@ -38,6 +38,12 @@
3838
"close-small-hovered-dark": {
3939
"body": "<g fill=\"none\"><circle opacity=\"0.13\" cx=\"8\" cy=\"8\" r=\"8\" fill=\"#F0F1F2\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.4939 4.48784C11.3002 4.28007 10.9724 4.27548 10.7729 4.47775L8.00074 7.28849L5.22871 4.47788C5.02922 4.27561 4.70143 4.2802 4.50768 4.48797C4.32506 4.68382 4.32933 4.98882 4.51736 5.17947L7.29908 7.99991L4.51756 10.8201C4.32953 11.0108 4.32526 11.3158 4.50788 11.5116C4.70163 11.7194 5.02942 11.724 5.22892 11.5217L8.00074 8.71133L10.7727 11.5219C10.9722 11.7241 11.3 11.7196 11.4937 11.5118C11.6764 11.3159 11.6721 11.0109 11.484 10.8203L8.7024 7.99991L11.4843 5.17934C11.6723 4.98869 11.6766 4.68368 11.4939 4.48784Z\" fill=\"#868A91\"/></g>"
4040
},
41+
"copy": {
42+
"body": "<g fill=\"none\"><rect x=\"2.5\" y=\"3.5\" width=\"9\" height=\"10\" rx=\"1.5\" stroke=\"#6C707E\"/><rect x=\"5\" y=\"6\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#6C707E\"/><rect x=\"5\" y=\"8\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#6C707E\"/><rect x=\"5\" y=\"10\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#6C707E\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.0017 2H11.5998C12.373 2 12.9998 2.6268 12.9998 3.4V3.91081C13.0011 3.94038 13.0017 3.97011 13.0017 4V11.5482C13.6063 11.1124 13.9998 10.4021 13.9998 9.6V3.4C13.9998 2.07452 12.9253 1 11.5998 1H6.39978C5.59677 1 4.88587 1.39437 4.4502 2H6.39978H11.0017Z\" fill=\"#6C707E\"/></g>"
43+
},
44+
"copy-dark": {
45+
"body": "<g fill=\"none\"><rect x=\"2.5\" y=\"3.5\" width=\"9\" height=\"10\" rx=\"1.5\" stroke=\"#CED0D6\"/><rect x=\"5\" y=\"6\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#CED0D6\"/><rect x=\"5\" y=\"8\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#CED0D6\"/><rect x=\"5\" y=\"10\" width=\"4\" height=\"1\" rx=\"0.5\" fill=\"#CED0D6\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.0017 2H11.5998C12.373 2 12.9998 2.6268 12.9998 3.4V3.91081C13.0011 3.94038 13.0017 3.97011 13.0017 4V11.5482C13.6063 11.1124 13.9998 10.4021 13.9998 9.6V3.4C13.9998 2.07452 12.9253 1 11.5998 1H6.39978C5.59677 1 4.88587 1.39437 4.4502 2H6.39978H11.0017Z\" fill=\"#CED0D6\"/></g>"
46+
},
4147
"delete": {
4248
"body": "<g fill=\"none\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 2H9C9.55228 2 10 2.44772 10 3H6C6 2.44772 6.44772 2 7 2ZM5 3C5 1.89543 5.89543 1 7 1H9C10.1046 1 11 1.89543 11 3H13C13.5523 3 14 3.44772 14 4V5V6H13V13C13 14.1046 12.1046 15 11 15H5C3.89543 15 3 14.1046 3 13V6H2V5V4C2 3.44772 2.44772 3 3 3H5ZM11 4H10H6H5H3V5H4H12H13V4H11ZM4 6H12V13C12 13.5523 11.5523 14 11 14H5C4.44772 14 4 13.5523 4 13V6ZM6.5 7C6.22386 7 6 7.22386 6 7.5V11.5C6 11.7761 6.22386 12 6.5 12C6.77614 12 7 11.7761 7 11.5V7.5C7 7.22386 6.77614 7 6.5 7ZM9 7.5C9 7.22386 9.22386 7 9.5 7C9.77614 7 10 7.22386 10 7.5V11.5C10 11.7761 9.77614 12 9.5 12C9.22386 12 9 11.7761 9 11.5V7.5Z\" fill=\"#6C707E\"/></g>"
4349
},

src/components/ProjectCard/ProjectCard.vue

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,54 @@ watchEffect(async () => {
7373
})
7474
7575
// ==================== More Button ====================
76+
async function copyProjectPath(): Promise<void> {
77+
const text = projectPath.value
78+
if (!text) {
79+
return
80+
}
81+
82+
try {
83+
if (navigator.clipboard && window.isSecureContext) {
84+
await navigator.clipboard.writeText(text)
85+
}
86+
}
87+
catch {}
88+
}
89+
7690
function getDeleteLabel() {
7791
if (!projectExists.value) {
78-
return t('project_card.remove')
92+
return t('project_card.actions.remove')
7993
}
80-
return projectIsTemporary?.value === true ? t('project_card.delete') : t('project_card.remove')
94+
return projectIsTemporary?.value === true
95+
? t('project_card.actions.delete')
96+
: t('project_card.actions.remove')
8197
}
8298
8399
const projectActions = computed<JeMenuOptionProps[]>(() => [
84100
{
85101
value: 'explorer:open',
86-
label: t('project_card.open_in_explorer'),
102+
label: t('project_card.actions.open_in_explorer'),
103+
disabled: !projectExists.value,
87104
onClick: () => window.api.openInExplorer(projectPath.value),
88105
},
89106
{
90107
value: 'terminal:open',
91-
label: t('project_card.open_in_terminal'),
108+
label: t('project_card.actions.open_in_terminal'),
92109
icon: 'light:i-jet:terminal dark:i-jet:terminal-dark',
110+
disabled: !projectExists.value,
93111
onClick: () => window.api.openInTerminal(projectPath.value),
94112
},
113+
{
114+
value: 'clipboard:copy',
115+
label: t('project_card.actions.copy_path'),
116+
icon: 'light:i-jet:copy dark:i-jet:copy-dark',
117+
disabled: !projectPath.value,
118+
onClick: copyProjectPath,
119+
},
95120
{ value: 'line', isLine: true },
96121
{
97122
value: 'edit',
98-
label: t('project_card.edit'),
123+
label: t('project_card.actions.edit'),
99124
icon: 'light:i-jet:edit dark:i-jet:edit-dark',
100125
onClick: () => {
101126
initializeUpdateProjectState(props.projectItem)
@@ -183,14 +208,10 @@ function showMenu() {
183208
"
184209
truncate
185210
text="secondary"
211+
@click.stop
186212
>
187213
{{ projectKind === ProjectKind.FORK ? 'Forked from' : 'Cloned from' }}
188-
<JeLink
189-
v-if="projectFromUrl"
190-
type="web"
191-
:on-click="() => openLink(projectFromUrl)"
192-
@click.stop
193-
>
214+
<JeLink v-if="projectFromUrl" type="web" :on-click="() => openLink(projectFromUrl)">
194215
{{ projectFromName || projectFromUrl }}
195216
</JeLink>
196217
<span v-else>{{ projectFromName }}</span>

src/locales/en.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ license_pop:
7878
project_card:
7979
temporary: Temporary
8080
opening: Opening...
81-
open_in_explorer: Open in Explorer
82-
open_in_terminal: Open in Terminal
83-
edit: Edit
84-
remove: Remove
85-
delete: Delete
81+
actions:
82+
open_in_explorer: Open in Explorer
83+
open_in_terminal: Open in Terminal
84+
copy_path: Copy Path
85+
edit: Edit
86+
remove: Remove
87+
delete: Delete
8688
project_config:
8789
name: Name
8890
group: Project Group

src/locales/zh-CN.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ license_pop:
7070
project_card:
7171
temporary: 临时
7272
opening: 正在打开...
73-
open_in_explorer: 在资源管理器中打开
74-
open_in_terminal: 在终端中打开
75-
edit: 编辑
76-
remove: 移除
77-
delete: 删除
73+
actions:
74+
open_in_explorer: 在资源管理器中打开
75+
open_in_terminal: 在终端中打开
76+
copy_path: 复制路径
77+
edit: 编辑
78+
remove: 移除
79+
delete: 删除
7880
project_config:
7981
name: 名称
8082
group: 项目组

0 commit comments

Comments
 (0)