-
Notifications
You must be signed in to change notification settings - Fork 39
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
fabienSvstr
committed
Feb 26, 2025
1 parent
f0a3e31
commit e63a404
Showing
18 changed files
with
970 additions
and
467 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
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,37 @@ | ||
/* Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS */ | ||
|
||
$breakpoints: ( | ||
'xs': ( | ||
max-width: 576px, | ||
), | ||
'sm': ( | ||
max-width: 768px, | ||
), | ||
'md': ( | ||
max-width: 992px, | ||
), | ||
'lg': ( | ||
max-width: 1200px, | ||
), | ||
'wide': ( | ||
max-width: 1500px, | ||
), | ||
'ultra-wide': ( | ||
max-width: 1921px, | ||
), | ||
) !default; | ||
|
||
@mixin breakpoint($breakpoint) { | ||
// If the key exists in the map | ||
@if map-has-key($breakpoints, $breakpoint) { | ||
// Prints a media query based on the value | ||
@media #{inspect(map-get($breakpoints, $breakpoint))} { | ||
@content; | ||
} | ||
} | ||
// If the key doesn't exist in the map | ||
@else { | ||
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. " | ||
+ "Available breakpoints are: #{map-keys($breakpoints)}."; | ||
} | ||
} |
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,78 @@ | ||
<!-- Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS --> | ||
|
||
<template> | ||
<ion-page> | ||
<sidebar-menu | ||
v-if="userInfo" | ||
:user-info="userInfo" | ||
@sidebar-width-changed="onSidebarWidthChanged" | ||
/> | ||
<tab-menu | ||
v-if="userInfo" | ||
v-show="menuMode === MenuMode.Tabs" | ||
:user-info="userInfo" | ||
/> | ||
</ion-page> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ClientInfo, getClientInfo as parsecGetClientInfo } from '@/parsec'; | ||
import { IonPage } from '@ionic/vue'; | ||
import { Ref, onMounted, onUnmounted, ref } from 'vue'; | ||
import TabMenu from '@/views/menu/TabMenu.vue'; | ||
import SidebarMenu from '@/views/menu/SidebarMenu.vue'; | ||
|
||
enum MenuMode { | ||
Sidebar = 'sidebar', | ||
Tabs = 'tabs', | ||
} | ||
|
||
const sidebarWidth = ref<number>(0); | ||
const userInfo: Ref<ClientInfo | null> = ref(null); | ||
const menuMode = ref<MenuMode>(MenuMode.Sidebar); | ||
|
||
function onSidebarWidthChanged(value: number): void { | ||
sidebarWidth.value = value; | ||
setToastOffset(value); | ||
} | ||
|
||
async function updateWindowWidth(): Promise<void> { | ||
if (window.innerWidth <= 768) { | ||
setToastOffset(0); | ||
menuMode.value = MenuMode.Tabs; | ||
} else { | ||
setToastOffset(sidebarWidth.value); | ||
menuMode.value = MenuMode.Sidebar; | ||
} | ||
} | ||
|
||
onMounted(async () => { | ||
const infoResult = await parsecGetClientInfo(); | ||
|
||
if (infoResult.ok) { | ||
userInfo.value = infoResult.value; | ||
} else { | ||
window.electronAPI.log('error', `Failed to retrieve user info ${JSON.stringify(infoResult.error)}`); | ||
} | ||
|
||
window.addEventListener('resize', updateWindowWidth); | ||
updateWindowWidth(); | ||
}); | ||
|
||
onUnmounted(async () => { | ||
setToastOffset(0); | ||
window.removeEventListener('resize', updateWindowWidth); | ||
}); | ||
|
||
function setToastOffset(width: number): void { | ||
window.document.documentElement.style.setProperty('--ms-toast-offset', `${width}px`); | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '@/theme/responsive-mixin'; | ||
|
||
* { | ||
transition: all 100ms ease-in-out; | ||
} | ||
</style> |
Oops, something went wrong.