Skip to content

Commit

Permalink
feat(ui/dashboard): new dashboard ui refresh for desktop devices (#957)
Browse files Browse the repository at this point in the history
* feat(ui/dashboard): new dashboard ui refresh on desktop device

* add z-index for login dialog layer
  • Loading branch information
qwqcode authored Aug 19, 2024
1 parent 4d7e157 commit adcb75a
Show file tree
Hide file tree
Showing 31 changed files with 829 additions and 354 deletions.
6 changes: 5 additions & 1 deletion ui/artalk-sidebar/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AppHeader: typeof import('./src/components/AppHeader.vue')['default']
AppNavigation: typeof import('./src/components/AppNavigation.vue')['default']
AppNavigationDesktop: typeof import('./src/components/AppNavigationDesktop.vue')['default']
AppNavigationMobile: typeof import('./src/components/AppNavigationMobile.vue')['default']
AppNavigationSearch: typeof import('./src/components/AppNavigationSearch.vue')['default']
FileUploader: typeof import('./src/components/FileUploader.vue')['default']
Header: typeof import('./src/components/Header.vue')['default']
ItemTextEditor: typeof import('./src/components/ItemTextEditor.vue')['default']
Expand All @@ -22,7 +27,6 @@ declare module 'vue' {
SiteCreate: typeof import('./src/components/SiteCreate.vue')['default']
SiteEditor: typeof import('./src/components/SiteEditor.vue')['default']
SiteSwitcher: typeof import('./src/components/SiteSwitcher.vue')['default']
Tab: typeof import('./src/components/Tab.vue')['default']
UserEditor: typeof import('./src/components/UserEditor.vue')['default']
}
}
4 changes: 3 additions & 1 deletion ui/artalk-sidebar/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="strict-origin" />
<title>Artalk Sidebar</title>
<meta name="robots" content="noindex" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<title>Artalk</title>
</head>
<body>
<div id="app"></div>
Expand Down
Binary file added ui/artalk-sidebar/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 33 additions & 12 deletions ui/artalk-sidebar/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,26 @@ const darkMode = ref(bootParams.darkMode)
class="app-wrap artalk atk-sidebar"
:class="{ 'atk-dark-mode': darkMode }"
>
<Header />
<Tab />
<AppHeader />
<AppNavigation />

<div class="main">
<div ref="scrollableArea" class="atk-sidebar-inner">
<router-view />
<div class="atk-sidebar-container">
<router-view />
</div>
</div>
<LoadingLayer v-if="nav.isPageLoading" />
</div>
</div>
</template>

<style scoped lang="scss">
$headerHeight: 61px;
$subHeaderHeight: 41px;
$maxWidth: 1100px;
$sidebarWidth: 280px;
.app-wrap {
background: var(--at-color-bg);
color: var(--at-color-font);
Expand All @@ -110,8 +117,12 @@ const darkMode = ref(bootParams.darkMode)
.atk-sidebar-inner {
overflow-y: auto;
height: calc(100vh - 61px - 41px);
height: calc(100vh - $headerHeight - $subHeaderHeight);
padding-bottom: 50px;
@media (min-width: 1024px) {
height: calc(100vh - $headerHeight - 51px);
}
}
// 分页条占位
Expand All @@ -123,15 +134,25 @@ const darkMode = ref(bootParams.darkMode)
left: 0;
background: var(--at-color-bg);
border-top: 1px solid var(--at-color-border);
}
}
// A patch for loading
// Because the parent position set to fixed,
// the loading layer will be fixed to the area if position is absolute (which is default for atk-loading)
.atk-loading {
position: fixed;
top: 102px;
height: calc(100% - 102px);
}
:deep(.atk-sidebar-container) {
position: relative;
}
@media (min-width: 1024px) {
:deep(.atk-sidebar-container) {
max-width: $maxWidth;
margin: 0 auto;
width: 100%;
}
}
@media (min-width: 1024px) and (max-width: calc($maxWidth + $sidebarWidth * 2)) {
:deep(.atk-sidebar-container) {
margin-left: $sidebarWidth;
max-width: calc(100% - $sidebarWidth);
}
}
</style>
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-comments.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-pages.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-sites.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-transfer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui/artalk-sidebar/src/assets/nav-icon-users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ const logout = () => {
</template>

<div class="title">
<div class="text">{{ isAdmin ? t('ctrlCenter') : t('msgCenter') }}</div>
<div class="text show-mobile">{{ isAdmin ? t('ctrlCenter') : t('msgCenter') }}</div>
<div class="text show-desktop">
<template v-if="!isAdmin">{{ t('msgCenter') }}</template>
<template v-else-if="!!curtSite">{{ curtSite }}</template>
<template v-else>
<img src="../assets/favicon.png" class="artalk-logo" draggable="false" />
</template>
</div>
</div>

<div class="close-btn"></div>
Expand All @@ -57,6 +64,10 @@ const logout = () => {
align-items: center;
border-bottom: 1px solid var(--at-color-border);
@media (min-width: 1024px) {
background: #f6f8fa;
}
.avatar {
position: relative;
height: 60px;
Expand Down Expand Up @@ -122,6 +133,28 @@ const logout = () => {
color: var(--at-color-deep);
font-size: 20px;
&.show-mobile {
display: none;
}
&.show-desktop {
display: inline-block;
&::after {
display: none;
}
}
@media (max-width: 1023px) {
&.show-mobile {
display: inline-block;
}
&.show-desktop {
display: none;
}
}
&::after {
content: '';
position: absolute;
Expand All @@ -133,6 +166,17 @@ const logout = () => {
opacity: 0.4;
}
}
.artalk-logo {
border-radius: 2px;
height: 40px;
width: 40px;
background: #697182;
text-align: center;
line-height: 30px;
font-size: 13px;
color: #fff;
}
}
.close-btn {
Expand Down
11 changes: 11 additions & 0 deletions ui/artalk-sidebar/src/components/AppNavigation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts"></script>

<template>
<!-- Desktop -->
<AppNavigationDesktop />

<!-- Mobile or Sidebar -->
<AppNavigationMobile />
</template>

<style scoped lang="scss"></style>
171 changes: 171 additions & 0 deletions ui/artalk-sidebar/src/components/AppNavigationDesktop.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<script lang="ts" setup>
/**
* The part of the navigation bar that is displayed on desktop
*/
import SearchIcon from '../assets/nav-icon-search.svg'
import { useNavigationMenu } from './AppNavigationMenu'
const nav = useNavigationMenu()
const { t } = useI18n()
</script>

<template>
<div class="sidebar-navigation">
<div
v-for="(page, pageName) in nav.pages"
:key="pageName"
class="item"
:class="{ active: pageName === nav.curtPage }"
@click="nav.goPage(pageName as string)"
>
<span class="icon" :style="{ background: `url('${page.icon}')` }"></span>
{{ t(page.label) }}
</div>
</div>

<div v-if="!!Object.keys(nav.tabs).length" class="top-tabbar-wrap atk-sidebar-container">
<div class="top-tabbar">
<div
v-for="(tabLabel, tabName) in nav.tabs"
:key="tabName"
class="item-wrap"
:class="{ active: nav.curtTab === tabName }"
@click="nav.goTab(tabName as string)"
>
<div class="item">{{ t(tabLabel) }}</div>
</div>

<div v-if="nav.isSearchEnabled" class="item-wrap search-btn" @click="nav.showSearch()">
<div class="item">
<div class="icon" :style="{ background: `url('${SearchIcon}')` }"></div>
</div>
</div>
</div>

<AppNavigationSearch v-if="!nav.isMobile" :state="nav.searchState" />
</div>
</template>

<style lang="scss" scoped>
$colorMain: #8ecee2;
.sidebar-navigation {
z-index: 10;
width: 280px;
position: fixed;
left: 0;
top: 61px;
height: calc(100vh - 61px - 41px);
padding: 20px;
background: #fff;
border-right: 1px solid var(--at-color-border);
@media (max-width: 1023px) {
display: none;
}
.item {
position: relative;
display: flex;
align-items: center;
padding: 6px 12px;
font-size: 15px;
border-radius: 6px;
cursor: pointer;
user-select: none;
transition: background 0.2s;
&:not(:last-child) {
margin-bottom: 4px;
}
&.active {
font-weight: bold;
color: #181a1e;
&::before {
content: '';
display: block;
position: absolute;
left: -8px;
top: 5%;
background: $colorMain;
height: 90%;
width: 4px;
border-radius: 1000px;
}
}
&:hover,
&.active {
background: #f4f5f7;
}
.icon {
width: 20px;
height: 20px;
margin-right: 10px;
background-size: contain;
background-repeat: no-repeat;
}
}
}
.top-tabbar-wrap {
@media (max-width: 1023px) {
display: none;
}
}
.top-tabbar {
display: flex;
align-items: center;
height: 50px;
margin: 0 auto;
padding: 0 8px;
border-bottom: 1px solid var(--at-color-border);
.item-wrap {
margin-bottom: -2px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
height: 100%;
padding: 0;
cursor: pointer;
user-select: none;
border-bottom: 2px solid transparent;
&.active {
font-weight: bold;
border-color: $colorMain;
}
&:not(:last-child) {
margin-right: 7px;
}
&:hover .item {
background: var(--at-color-bg-grey-transl);
}
&.search-btn {
margin-left: auto;
}
.item {
border-radius: 4px;
padding: 5px 16px;
transition: background 0.2s;
.icon {
width: 20px;
height: 20px;
background-size: contain;
background-repeat: no-repeat;
}
}
}
}
</style>
Loading

0 comments on commit adcb75a

Please sign in to comment.