mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
Remove global titlebar
This commit is contained in:
@@ -27,7 +27,7 @@ import { SidebarItem } from './sidebar-item';
|
|||||||
|
|
||||||
const SidebarContainer = styled.div`
|
const SidebarContainer = styled.div`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-height: calc(100vh - 120px); // Account for titlebar and playerbar
|
max-height: calc(100vh - 90px); // Account for and playerbar
|
||||||
user-select: none;
|
user-select: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -54,6 +54,10 @@ const SidebarImage = styled.img`
|
|||||||
background: var(--placeholder-bg);
|
background: var(--placeholder-bg);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const ActionsContainer = styled(Grid)`
|
||||||
|
-webkit-app-region: drag;
|
||||||
|
`;
|
||||||
|
|
||||||
export const Sidebar = () => {
|
export const Sidebar = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const sidebar = useSidebarStore();
|
const sidebar = useSidebarStore();
|
||||||
@@ -74,7 +78,7 @@ export const Sidebar = () => {
|
|||||||
maxHeight: showImage ? `calc(100% - ${sidebar.leftWidth})` : '100%',
|
maxHeight: showImage ? `calc(100% - ${sidebar.leftWidth})` : '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid p={10}>
|
<ActionsContainer p={10}>
|
||||||
<Grid.Col span={8}>
|
<Grid.Col span={8}>
|
||||||
<SpotlightProvider actions={[]}>
|
<SpotlightProvider actions={[]}>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -110,7 +114,7 @@ export const Sidebar = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</ActionsContainer>
|
||||||
<Stack
|
<Stack
|
||||||
spacing={0}
|
spacing={0}
|
||||||
sx={{ overflowY: 'auto' }}
|
sx={{ overflowY: 'auto' }}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Group } from '@mantine/core';
|
import { Group } from '@mantine/core';
|
||||||
import { openModal, closeAllModals } from '@mantine/modals';
|
import { openModal, closeAllModals } from '@mantine/modals';
|
||||||
import {
|
import {
|
||||||
RiMenu3Fill,
|
|
||||||
RiSearch2Line,
|
RiSearch2Line,
|
||||||
RiSettings2Fill,
|
RiSettings2Fill,
|
||||||
RiSettings2Line,
|
RiSettings2Line,
|
||||||
RiEdit2Line,
|
RiEdit2Line,
|
||||||
RiLockLine,
|
RiLockLine,
|
||||||
|
RiMenuFill,
|
||||||
} from 'react-icons/ri';
|
} from 'react-icons/ri';
|
||||||
import { Button, DropdownMenu, Text } from '/@/components';
|
import { Button, DropdownMenu, Text } from '/@/components';
|
||||||
import { ServerList } from '/@/features/servers';
|
import { ServerList } from '/@/features/servers';
|
||||||
@@ -72,7 +72,7 @@ export const AppMenu = () => {
|
|||||||
size="xs"
|
size="xs"
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
>
|
>
|
||||||
<RiMenu3Fill
|
<RiMenuFill
|
||||||
color="var(--titlebar-fg)"
|
color="var(--titlebar-fg)"
|
||||||
size={15}
|
size={15}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,36 +11,31 @@ interface TitlebarProps {
|
|||||||
const TitlebarContainer = styled.div`
|
const TitlebarContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 1rem;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
color: var(--titlebar-fg);
|
color: var(--titlebar-fg);
|
||||||
|
|
||||||
button {
|
button {
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
|
|
||||||
svg {
|
|
||||||
transform: scaleX(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Left = styled.div`
|
// const Left = styled.div`
|
||||||
display: flex;
|
// display: flex;
|
||||||
flex: 1/3;
|
// flex: 1/3;
|
||||||
justify-content: center;
|
// justify-content: center;
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
padding-left: 1rem;
|
// padding-left: 1rem;
|
||||||
`;
|
// opacity: 0;
|
||||||
|
// `;
|
||||||
|
|
||||||
const Center = styled.div`
|
// const Center = styled.div`
|
||||||
display: flex;
|
// display: flex;
|
||||||
flex: 1/3;
|
// flex: 1/3;
|
||||||
justify-content: center;
|
// justify-content: center;
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
`;
|
// opacity: 0;
|
||||||
|
// `;
|
||||||
|
|
||||||
const Right = styled.div`
|
const Right = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -53,10 +48,6 @@ export const Titlebar = ({ children }: TitlebarProps) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TitlebarContainer>
|
<TitlebarContainer>
|
||||||
<Left>
|
|
||||||
<Group>Feishin</Group>
|
|
||||||
</Left>
|
|
||||||
<Center />
|
|
||||||
<Right>
|
<Right>
|
||||||
{children}
|
{children}
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import React, { Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useDisclosure, useTimeout } from '@mantine/hooks';
|
import { useDisclosure, useTimeout } from '@mantine/hooks';
|
||||||
import type { Variants } from 'framer-motion';
|
import type { Variants } from 'framer-motion';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
@@ -7,16 +7,15 @@ import throttle from 'lodash/throttle';
|
|||||||
import { TbArrowBarLeft } from 'react-icons/tb';
|
import { TbArrowBarLeft } from 'react-icons/tb';
|
||||||
import { Outlet, useLocation } from 'react-router';
|
import { Outlet, useLocation } from 'react-router';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { PlayQueue } from '/@/features/now-playing/';
|
|
||||||
import { Titlebar } from '/@/features/titlebar/components/titlebar';
|
|
||||||
import { AppRoute } from '/@/router/routes';
|
import { AppRoute } from '/@/router/routes';
|
||||||
import { useAppStore } from '/@/store';
|
import { useAppStore } from '/@/store';
|
||||||
import { useSettingsStore } from '/@/store/settings.store';
|
import { useSettingsStore } from '/@/store/settings.store';
|
||||||
import { PlaybackType } from '/@/types';
|
import { PlaybackType } from '/@/types';
|
||||||
import { constrainRightSidebarWidth, constrainSidebarWidth } from '/@/utils';
|
import { constrainRightSidebarWidth, constrainSidebarWidth } from '/@/utils';
|
||||||
import { Playerbar } from '../features/player';
|
import { Playerbar } from '/@/features/player';
|
||||||
import { Sidebar } from '../features/sidebar/components/sidebar';
|
import { Sidebar } from '/@/features/sidebar/components/sidebar';
|
||||||
import { useAppStoreActions } from '../store/app.store';
|
import { useAppStoreActions } from '/@/store/app.store';
|
||||||
|
import { PlayQueue } from '/@/features/now-playing';
|
||||||
|
|
||||||
if (!isElectron()) {
|
if (!isElectron()) {
|
||||||
useSettingsStore.getState().setSettings({
|
useSettingsStore.getState().setSettings({
|
||||||
@@ -30,21 +29,14 @@ if (!isElectron()) {
|
|||||||
const Layout = styled.div`
|
const Layout = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
'header'
|
|
||||||
'main'
|
'main'
|
||||||
'player';
|
'player';
|
||||||
grid-template-rows: 30px 1fr 90px;
|
grid-template-rows: 1fr 90px;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TitlebarContainer = styled.header`
|
|
||||||
grid-area: header;
|
|
||||||
background: var(--titlebar-bg);
|
|
||||||
-webkit-app-region: drag;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const MainContainer = styled.main<{
|
const MainContainer = styled.main<{
|
||||||
leftSidebarWidth: string;
|
leftSidebarWidth: string;
|
||||||
rightExpanded?: boolean;
|
rightExpanded?: boolean;
|
||||||
@@ -178,10 +170,11 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|||||||
|
|
||||||
const queueDrawerVariants: Variants = {
|
const queueDrawerVariants: Variants = {
|
||||||
closed: {
|
closed: {
|
||||||
height: 'calc(100% - 120px)',
|
height: 'calc(100vh - 150px)',
|
||||||
minWidth: '400px',
|
minWidth: '400px',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: 0,
|
right: 0,
|
||||||
|
top: '50px',
|
||||||
transition: {
|
transition: {
|
||||||
duration: 0.3,
|
duration: 0.3,
|
||||||
ease: 'anticipate',
|
ease: 'anticipate',
|
||||||
@@ -190,10 +183,14 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|||||||
x: '50vw',
|
x: '50vw',
|
||||||
},
|
},
|
||||||
open: {
|
open: {
|
||||||
height: 'calc(100% - 120px)',
|
boxShadow: '4px 4px 10px 0px rgba(0,0,0,.75)',
|
||||||
|
height: 'calc(100vh - 150px)',
|
||||||
minWidth: '400px',
|
minWidth: '400px',
|
||||||
|
opacity: 0.98,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: 0,
|
right: '20px',
|
||||||
|
top: '50px',
|
||||||
|
|
||||||
transition: {
|
transition: {
|
||||||
damping: 10,
|
damping: 10,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
@@ -265,9 +262,6 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Layout>
|
<Layout>
|
||||||
<TitlebarContainer>
|
|
||||||
<Titlebar />
|
|
||||||
</TitlebarContainer>
|
|
||||||
<MainContainer
|
<MainContainer
|
||||||
leftSidebarWidth={sidebar.leftWidth}
|
leftSidebarWidth={sidebar.leftWidth}
|
||||||
rightExpanded={showSideQueue}
|
rightExpanded={showSideQueue}
|
||||||
@@ -358,7 +352,9 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Outlet />
|
<Suspense fallback={<></>}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
</MainContainer>
|
</MainContainer>
|
||||||
<PlayerbarContainer>
|
<PlayerbarContainer>
|
||||||
<Playerbar />
|
<Playerbar />
|
||||||
|
|||||||
Reference in New Issue
Block a user