mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-25 07:33:49 +08:00
fix(sources): hide unavailable update and management entries
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
|
||||
<div class="border-t border-slate-200 pt-4 dark:border-slate-800">
|
||||
<button
|
||||
v-if="storeFilter !== 'spark'"
|
||||
v-if="canManageApps"
|
||||
type="button"
|
||||
class="flex w-full items-center gap-3 rounded-2xl border border-transparent px-4 py-3 text-left text-sm font-medium text-slate-600 transition hover:border-brand/30 hover:bg-brand/5 hover:text-brand focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
@click="$emit('list')"
|
||||
@@ -98,6 +98,7 @@
|
||||
<span>应用管理</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="canOpenUpdateCenter"
|
||||
type="button"
|
||||
class="flex w-full items-center gap-3 rounded-2xl border border-transparent px-4 py-3 text-left text-sm font-medium text-slate-600 transition hover:border-brand/30 hover:bg-brand/5 hover:text-brand focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
@click="$emit('update')"
|
||||
@@ -110,15 +111,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import ThemeToggle from "./ThemeToggle.vue";
|
||||
import amberLogo from "../assets/imgs/spark-store.svg";
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
categories: Record<string, any>;
|
||||
activeCategory: string;
|
||||
categoryCounts: Record<string, number>;
|
||||
themeMode: "light" | "dark" | "auto";
|
||||
sparkAvailable: boolean;
|
||||
apmAvailable: boolean;
|
||||
storeFilter: "spark" | "apm" | "both";
|
||||
}>();
|
||||
@@ -135,6 +138,15 @@ const toggleTheme = () => {
|
||||
emit("toggle-theme");
|
||||
};
|
||||
|
||||
const canManageApps = computed(() => {
|
||||
return (
|
||||
(props.storeFilter !== "apm" && props.sparkAvailable) ||
|
||||
(props.storeFilter !== "spark" && props.apmAvailable)
|
||||
);
|
||||
});
|
||||
|
||||
const canOpenUpdateCenter = canManageApps;
|
||||
|
||||
const selectCategory = (category: string) => {
|
||||
emit("select-category", category);
|
||||
};
|
||||
|
||||
@@ -29,10 +29,11 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<div
|
||||
v-if="storeFilter === 'both'"
|
||||
v-if="showOriginSwitcher"
|
||||
class="flex items-center rounded-2xl border border-slate-200/70 p-1 dark:border-slate-800/70"
|
||||
>
|
||||
<button
|
||||
v-if="apmEnabled"
|
||||
type="button"
|
||||
class="rounded-xl px-4 py-1.5 text-sm font-semibold transition"
|
||||
:class="
|
||||
@@ -46,6 +47,7 @@
|
||||
APM 软件
|
||||
</button>
|
||||
<button
|
||||
v-if="sparkEnabled"
|
||||
type="button"
|
||||
class="rounded-xl px-4 py-1.5 text-sm font-semibold transition"
|
||||
:class="
|
||||
@@ -185,7 +187,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from "vue";
|
||||
import { computed, reactive } from "vue";
|
||||
import { App } from "../global/typedefinition";
|
||||
import { APM_STORE_BASE_URL } from "../global/storeConfig";
|
||||
|
||||
@@ -209,13 +211,14 @@ const canOpenDetail = (app: App) => {
|
||||
);
|
||||
};
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
show: boolean;
|
||||
apps: App[];
|
||||
loading: boolean;
|
||||
error: string;
|
||||
activeOrigin: "apm" | "spark";
|
||||
storeFilter: "spark" | "apm" | "both";
|
||||
sparkAvailable: boolean;
|
||||
apmAvailable: boolean;
|
||||
}>();
|
||||
|
||||
@@ -233,4 +236,16 @@ const onOverlayWheel = (e: WheelEvent) => {
|
||||
if (target.closest(".overflow-y-auto, .overflow-auto")) return;
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
const sparkEnabled = computed(() => {
|
||||
return props.storeFilter !== "apm" && props.sparkAvailable;
|
||||
});
|
||||
|
||||
const apmEnabled = computed(() => {
|
||||
return props.storeFilter !== "spark" && props.apmAvailable;
|
||||
});
|
||||
|
||||
const showOriginSwitcher = computed(() => {
|
||||
return sparkEnabled.value && apmEnabled.value;
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user