-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,155 additions
and
152 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup lang="ts"> | ||
import { useAsyncComputed } from '@/utils/utils' | ||
import { getUser } from '@/apis/user' | ||
import UserLink from '../user/UserLink.vue' | ||
const props = defineProps<{ | ||
owner: string | ||
}>() | ||
const user = useAsyncComputed(() => getUser(props.owner)) | ||
</script> | ||
|
||
<template> | ||
<UserLink class="owner-info" :user="user"> | ||
<i class="avatar" :style="user != null ? { backgroundImage: `url(${user.avatar})` } : null"></i> | ||
{{ owner }} | ||
</UserLink> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.owner-info { | ||
display: flex; | ||
align-items: center; | ||
gap: 4px; | ||
color: var(--ui-color-title); | ||
// TODO: extract to `@/components/ui/`? | ||
text-decoration: underline; | ||
transition: 0.1s; | ||
&:hover { | ||
color: var(--ui-color-primary-main); | ||
.avatar { | ||
border-color: var(--ui-color-primary-400); | ||
} | ||
} | ||
&:active { | ||
color: var(--ui-color-primary-600); | ||
.avatar { | ||
border-color: var(--ui-color-primary-600); | ||
} | ||
} | ||
} | ||
.avatar { | ||
display: block; | ||
width: 24px; | ||
height: 24px; | ||
border-radius: 50%; | ||
border: 2px solid var(--ui-color-grey-100); | ||
background-color: var(--ui-color-grey-100); | ||
background-position: center; | ||
background-size: contain; | ||
transition: 0.1s; | ||
} | ||
</style> |
52 changes: 52 additions & 0 deletions
52
spx-gui/src/components/community/project/ReleaseHistory.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,52 @@ | ||
<script setup lang="ts"> | ||
import { useQuery } from '@/utils/exception' | ||
import { humanizeTime } from '@/utils/utils' | ||
import { listReleases } from '@/apis/project-release' | ||
import { UITimeline, UITimelineItem, UILoading, UIError } from '@/components/ui' | ||
const props = defineProps<{ | ||
owner: string | ||
name: string | ||
}>() | ||
const { | ||
data: releases, | ||
isLoading, | ||
error, | ||
refetch | ||
} = useQuery( | ||
async () => { | ||
const { owner, name } = props | ||
const { data } = await listReleases({ | ||
projectFullName: `${owner}/${name}`, | ||
orderBy: 'createdAt', | ||
sortOrder: 'desc', | ||
pageIndex: 1, | ||
pageSize: 10 // load at most 10 recent releases | ||
}) | ||
return data | ||
}, | ||
{ en: 'Load release history failed', zh: '加载发布历史失败' } | ||
) | ||
</script> | ||
|
||
<template> | ||
<UILoading v-if="isLoading" /> | ||
<UIError v-else-if="error != null" :retry="refetch"> | ||
{{ $t(error.userMessage) }} | ||
</UIError> | ||
<p v-else-if="releases?.length === 0"> | ||
{{ $t({ en: 'No release history yet', zh: '暂无发布历史' }) }} | ||
</p> | ||
<UITimeline v-else-if="releases != null"> | ||
<UITimelineItem | ||
v-for="release in releases" | ||
:key="release.id" | ||
:time="$t(humanizeTime(release.createdAt))" | ||
> | ||
{{ release.description }} | ||
</UITimelineItem> | ||
</UITimeline> | ||
</template> | ||
<style lang="scss" scoped></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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import { parseRemixSource, stringifyRemixSource } from '@/apis/project' | ||
import { getProjectPageRoute } from '@/router' | ||
const props = defineProps<{ | ||
remixedFrom: string | ||
}>() | ||
const remixedFrom = computed(() => parseRemixSource(props.remixedFrom)) | ||
</script> | ||
|
||
<template> | ||
<p class="remixed-from"> | ||
{{ $t({ en: 'Remixed from', zh: '改编自' }) }} | ||
<RouterLink class="link" :to="getProjectPageRoute(remixedFrom.owner, remixedFrom.project)"> | ||
{{ stringifyRemixSource(remixedFrom.owner, remixedFrom.project) }} | ||
</RouterLink> | ||
</p> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.link { | ||
// TODO: extract to `@/components/ui/`? | ||
color: inherit; | ||
text-decoration: underline; | ||
&:hover { | ||
color: var(--ui-color-primary-main); | ||
} | ||
&:active { | ||
color: var(--ui-color-primary-600); | ||
} | ||
} | ||
</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
Oops, something went wrong.