feat(settings): 添加项目 Star 提示卡片
This commit is contained in:
parent
d282cab00c
commit
81a07570d1
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<!-- 侧边栏 (Desktop) -->
|
<!-- 侧边栏 (Desktop) -->
|
||||||
<div class="settings-sider">
|
<div class="settings-sider">
|
||||||
|
<div class="settings-sider-nav">
|
||||||
<div
|
<div
|
||||||
class="sider-item"
|
class="sider-item"
|
||||||
:class="{ activesec: activeTab === 'base' }"
|
:class="{ activesec: activeTab === 'base' }"
|
||||||
@ -65,6 +66,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="showStarCard" class="settings-star-card">
|
||||||
|
<div class="star-card-header">
|
||||||
|
<div class="star-card-badge">
|
||||||
|
<Star :size="12" />
|
||||||
|
<span>支持项目</span>
|
||||||
|
</div>
|
||||||
|
<button class="star-card-close lucide-icon-btn" @click="dismissStarCard" aria-label="关闭 Star 提示">
|
||||||
|
<X :size="14" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p class="star-card-title">给 Yuxi 点个 Star</p>
|
||||||
|
<p class="star-card-description">
|
||||||
|
如果这个项目帮到了你,欢迎去 GitHub 点亮一个 Star,让更多人看到它。
|
||||||
|
</p>
|
||||||
|
<a
|
||||||
|
class="star-card-link"
|
||||||
|
:href="projectRepoUrl"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="star-card-link-image"
|
||||||
|
src="https://img.shields.io/github/stars/xerrors/Yuxi?label=Yuxi&style=social"
|
||||||
|
alt="GitHub stars for Yuxi"
|
||||||
|
/>
|
||||||
|
<ExternalLink :size="13" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 顶部导航 (Mobile) -->
|
<!-- 顶部导航 (Mobile) -->
|
||||||
<div class="settings-mobile-nav">
|
<div class="settings-mobile-nav">
|
||||||
<div
|
<div
|
||||||
@ -138,9 +169,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch } from 'vue'
|
import { computed, onMounted, ref, watch } from 'vue'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import { Key as KeyIcon, Settings, SquareCode, User, Users, X } from 'lucide-vue-next'
|
import { ExternalLink, Key as KeyIcon, Settings, SquareCode, Star, User, Users, X } from 'lucide-vue-next'
|
||||||
import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
|
import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
|
||||||
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
|
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
|
||||||
import UserManagementComponent from '@/components/UserManagementComponent.vue'
|
import UserManagementComponent from '@/components/UserManagementComponent.vue'
|
||||||
@ -158,6 +189,10 @@ const emit = defineEmits(['update:visible', 'close'])
|
|||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const activeTab = ref('base')
|
const activeTab = ref('base')
|
||||||
|
const showStarCard = ref(true)
|
||||||
|
|
||||||
|
const STAR_CARD_STORAGE_KEY = 'yuxi-settings-star-card-dismissed'
|
||||||
|
const projectRepoUrl = 'https://github.com/xerrors/Yuxi'
|
||||||
|
|
||||||
const visible = computed({
|
const visible = computed({
|
||||||
get: () => props.visible,
|
get: () => props.visible,
|
||||||
@ -168,6 +203,15 @@ const handleClose = () => {
|
|||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dismissStarCard = () => {
|
||||||
|
showStarCard.value = false
|
||||||
|
localStorage.setItem(STAR_CARD_STORAGE_KEY, 'true')
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
showStarCard.value = localStorage.getItem(STAR_CARD_STORAGE_KEY) !== 'true'
|
||||||
|
})
|
||||||
|
|
||||||
// 根据用户权限设置默认标签页
|
// 根据用户权限设置默认标签页
|
||||||
watch(
|
watch(
|
||||||
() => props.visible,
|
() => props.visible,
|
||||||
@ -241,8 +285,6 @@ watch(
|
|||||||
padding: 52px 10px 12px;
|
padding: 52px 10px 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
background: var(--gray-50);
|
background: var(--gray-50);
|
||||||
border-right: 1px solid var(--gray-150);
|
border-right: 1px solid var(--gray-150);
|
||||||
@ -251,6 +293,13 @@ watch(
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-sider-nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.sider-item {
|
.sider-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 12px; /* Matches SettingView .sider > * */
|
padding: 6px 12px; /* Matches SettingView .sider > * */
|
||||||
@ -277,6 +326,88 @@ watch(
|
|||||||
color: var(--main-700);
|
color: var(--main-700);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-star-card {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: auto;
|
||||||
|
padding: 14px 12px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid rgba(4, 106, 130, 0.12);
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at top right, rgba(95, 174, 194, 0.18), transparent 48%),
|
||||||
|
linear-gradient(180deg, var(--main-5) 0%, var(--gray-0) 100%);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-badge {
|
||||||
|
width: fit-content;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(4, 106, 130, 0.08);
|
||||||
|
color: var(--main-700);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-close {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(255, 255, 255, 0.72);
|
||||||
|
color: var(--gray-600);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--gray-0);
|
||||||
|
color: var(--gray-900);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-title {
|
||||||
|
margin: 10px 0 6px;
|
||||||
|
color: var(--gray-900);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-description {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--gray-600);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-link {
|
||||||
|
margin-top: 12px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 6px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--gray-600);
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-card-link-image {
|
||||||
|
display: block;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Content Area */
|
/* Content Area */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user