mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 09:20:18 +08:00
feat: add sidebar toggle functionality
Signed-off-by: Elysia <a.elysia@proton.me>
This commit is contained in:
@@ -65,7 +65,8 @@ const indexHtml = path.join(RENDERER_DIST, "index.html");
|
|||||||
|
|
||||||
// Use app.getVersion() when the app is packaged.
|
// Use app.getVersion() when the app is packaged.
|
||||||
const getUserAgent = (): string => {
|
const getUserAgent = (): string => {
|
||||||
const version = app && app.isPackaged
|
const version =
|
||||||
|
app && app.isPackaged
|
||||||
? app.getVersion()
|
? app.getVersion()
|
||||||
: process.env.npm_package_version || "dev";
|
: process.env.npm_package_version || "dev";
|
||||||
return `APM-Store/${version}`;
|
return `APM-Store/${version}`;
|
||||||
@@ -73,7 +74,6 @@ const getUserAgent = (): string => {
|
|||||||
|
|
||||||
logger.info("User Agent: " + getUserAgent());
|
logger.info("User Agent: " + getUserAgent());
|
||||||
|
|
||||||
|
|
||||||
async function createWindow() {
|
async function createWindow() {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
title: "APM AppStore",
|
title: "APM AppStore",
|
||||||
|
|||||||
16
src/App.vue
16
src/App.vue
@@ -2,8 +2,18 @@
|
|||||||
<div
|
<div
|
||||||
class="flex min-h-screen flex-col bg-slate-50 text-slate-900 transition-colors duration-300 dark:bg-slate-950 dark:text-slate-100 lg:flex-row"
|
class="flex min-h-screen flex-col bg-slate-50 text-slate-900 transition-colors duration-300 dark:bg-slate-950 dark:text-slate-100 lg:flex-row"
|
||||||
>
|
>
|
||||||
|
<!-- 移动端侧边栏遮罩 -->
|
||||||
|
<div
|
||||||
|
v-if="isSidebarOpen"
|
||||||
|
class="fixed inset-0 z-40 bg-black/20 backdrop-blur-sm lg:hidden"
|
||||||
|
@click="isSidebarOpen = false"
|
||||||
|
></div>
|
||||||
|
|
||||||
<aside
|
<aside
|
||||||
class="w-full border-b border-slate-200/70 bg-white/80 px-5 py-6 backdrop-blur dark:border-slate-800/70 dark:bg-slate-900/70 lg:sticky lg:top-0 lg:flex lg:h-screen lg:w-72 lg:flex-col lg:border-b-0 lg:border-r"
|
class="fixed inset-y-0 left-0 z-50 w-72 transform border-r border-slate-200/70 bg-white/95 px-5 py-6 backdrop-blur transition-transform duration-300 ease-in-out dark:border-slate-800/70 dark:bg-slate-900 lg:sticky lg:top-0 lg:flex lg:h-screen lg:translate-x-0 lg:flex-col lg:border-b-0"
|
||||||
|
:class="
|
||||||
|
isSidebarOpen ? 'translate-x-0' : '-translate-x-full lg:translate-x-0'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<AppSidebar
|
<AppSidebar
|
||||||
:categories="categories"
|
:categories="categories"
|
||||||
@@ -12,6 +22,7 @@
|
|||||||
:theme-mode="themeMode"
|
:theme-mode="themeMode"
|
||||||
@toggle-theme="toggleTheme"
|
@toggle-theme="toggleTheme"
|
||||||
@select-category="selectCategory"
|
@select-category="selectCategory"
|
||||||
|
@close="isSidebarOpen = false"
|
||||||
/>
|
/>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
@@ -23,6 +34,7 @@
|
|||||||
@update-search="handleSearchInput"
|
@update-search="handleSearchInput"
|
||||||
@update="handleUpdate"
|
@update="handleUpdate"
|
||||||
@list="handleList"
|
@list="handleList"
|
||||||
|
@toggle-sidebar="isSidebarOpen = !isSidebarOpen"
|
||||||
/>
|
/>
|
||||||
<AppGrid
|
<AppGrid
|
||||||
:apps="filteredApps"
|
:apps="filteredApps"
|
||||||
@@ -167,6 +179,7 @@ const categories: Ref<Record<string, string>> = ref({});
|
|||||||
const apps: Ref<App[]> = ref([]);
|
const apps: Ref<App[]> = ref([]);
|
||||||
const activeCategory = ref("all");
|
const activeCategory = ref("all");
|
||||||
const searchQuery = ref("");
|
const searchQuery = ref("");
|
||||||
|
const isSidebarOpen = ref(false);
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
const currentScreenIndex = ref(0);
|
const currentScreenIndex = ref(0);
|
||||||
@@ -265,6 +278,7 @@ const toggleTheme = () => {
|
|||||||
const selectCategory = (category: string) => {
|
const selectCategory = (category: string) => {
|
||||||
activeCategory.value = category;
|
activeCategory.value = category;
|
||||||
searchQuery.value = "";
|
searchQuery.value = "";
|
||||||
|
isSidebarOpen.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const openDetail = (app: App) => {
|
const openDetail = (app: App) => {
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center">
|
<div class="flex flex-col gap-4 lg:flex-row lg:items-center">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-slate-200/70 bg-white/80 text-slate-500 shadow-sm backdrop-blur transition hover:bg-slate-50 lg:hidden dark:border-slate-800/70 dark:bg-slate-900/60 dark:text-slate-400 dark:hover:bg-slate-800"
|
||||||
|
@click="$emit('toggle-sidebar')"
|
||||||
|
title="切换侧边栏"
|
||||||
|
>
|
||||||
|
<i class="fas fa-bars"></i>
|
||||||
|
</button>
|
||||||
<TopActions @update="$emit('update')" @list="$emit('list')" />
|
<TopActions @update="$emit('update')" @list="$emit('list')" />
|
||||||
|
</div>
|
||||||
<div class="w-full flex-1">
|
<div class="w-full flex-1">
|
||||||
<label for="searchBox" class="sr-only">搜索应用</label>
|
<label for="searchBox" class="sr-only">搜索应用</label>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
@@ -38,6 +48,7 @@ const emit = defineEmits<{
|
|||||||
(e: "update-search", query: string): void;
|
(e: "update-search", query: string): void;
|
||||||
(e: "update"): void;
|
(e: "update"): void;
|
||||||
(e: "list"): void;
|
(e: "list"): void;
|
||||||
|
(e: "toggle-sidebar"): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const localSearchQuery = ref(props.searchQuery || "");
|
const localSearchQuery = ref(props.searchQuery || "");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex h-full flex-col gap-6">
|
<div class="flex h-full flex-col gap-6">
|
||||||
|
<div class="flex items-center justify-between gap-3">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<img
|
<img
|
||||||
:src="amberLogo"
|
:src="amberLogo"
|
||||||
@@ -16,6 +17,15 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex h-10 w-10 items-center justify-center rounded-2xl text-slate-400 hover:bg-slate-100 lg:hidden dark:hover:bg-slate-800"
|
||||||
|
@click="$emit('close')"
|
||||||
|
title="关闭侧边栏"
|
||||||
|
>
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ThemeToggle :theme-mode="themeMode" @toggle="toggleTheme" />
|
<ThemeToggle :theme-mode="themeMode" @toggle="toggleTheme" />
|
||||||
|
|
||||||
@@ -78,6 +88,7 @@ defineProps<{
|
|||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "toggle-theme"): void;
|
(e: "toggle-theme"): void;
|
||||||
(e: "select-category", category: string): void;
|
(e: "select-category", category: string): void;
|
||||||
|
(e: "close"): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const toggleTheme = () => {
|
const toggleTheme = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user