-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from goplus/dev
Release v1.4.4
- Loading branch information
Showing
17 changed files
with
329 additions
and
281 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
71 changes: 71 additions & 0 deletions
71
spx-gui/src/components/project/ProjectSharingLinkModal.vue
This file contains 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,71 @@ | ||
<template> | ||
<UIFormModal | ||
:title="$t({ en: 'Project sharing link', zh: '项目分享链接' })" | ||
:visible="props.visible" | ||
:auto-focus="false" | ||
@update:visible="emit('cancelled')" | ||
> | ||
<div class="desc"> | ||
{{ | ||
$t({ | ||
en: 'A sharing link to the project has been created. Feel free to copy it below to share the project with others.', | ||
zh: '项目的分享链接已生成。请复制下方链接,与他人分享该项目。' | ||
}) | ||
}} | ||
</div> | ||
<div class="link"> | ||
<UITextInput :value="projectSharingLink" :readonly="true" @focus="$event.target.select()" /> | ||
<UIButton class="copy-button" :loading="handleCopy.isLoading.value" @click="handleCopy.fn"> | ||
{{ $t({ en: 'Copy', zh: '复制' }) }} | ||
</UIButton> | ||
</div> | ||
</UIFormModal> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { UIButton, UIFormModal, UITextInput } from '@/components/ui' | ||
import { useMessageHandle } from '@/utils/exception' | ||
import { Project } from '@/models/project' | ||
import { computed } from 'vue' | ||
import { getProjectShareRoute } from '@/router' | ||
const props = defineProps<{ | ||
visible: boolean | ||
project: Project | ||
}>() | ||
const emit = defineEmits<{ | ||
cancelled: [] | ||
resolved: [] | ||
}>() | ||
const projectSharingLink = computed(() => { | ||
const { owner, name } = props.project | ||
// TODO: the check should be unnecessary | ||
if (owner == null || name == null) throw new Error(`owner (${owner}), name (${name}) required`) | ||
return `${location.origin}${getProjectShareRoute(owner, name)}` | ||
}) | ||
const handleCopy = useMessageHandle( | ||
() => navigator.clipboard.writeText(projectSharingLink.value), | ||
{ en: 'Failed to copy link to clipboard', zh: '分享链接复制到剪贴板失败' }, | ||
{ en: 'Link copied to clipboard', zh: '分享链接已复制到剪贴板' } | ||
) | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.desc { | ||
color: var(--ui-color-grey-900); | ||
margin-bottom: 8px; | ||
} | ||
.link { | ||
display: flex; | ||
margin-bottom: 16px; | ||
} | ||
.copy-button { | ||
margin-left: 12px; | ||
white-space: nowrap; | ||
} | ||
</style> |
This file contains 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 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 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 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.