mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Fix import
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Outlet } from 'react-router-dom';
|
import { Outlet } from 'react-router-dom';
|
||||||
import { Titlebar } from '../features/titlebar';
|
import { Titlebar } from '@/renderer/features/titlebar/components/titlebar';
|
||||||
|
|
||||||
const WindowsTitlebarContainer = styled.div`
|
const WindowsTitlebarContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Menu, Button } from '@mantine/core';
|
import { Menu, Button } from '@mantine/core';
|
||||||
import { Outlet } from 'react-router';
|
import { Outlet } from 'react-router';
|
||||||
import { Titlebar } from '@/renderer/features/titlebar';
|
import { Titlebar } from '@/renderer/features/titlebar/components/titlebar';
|
||||||
|
import { useAppStore } from '@/renderer/store';
|
||||||
import { constrainSidebarWidth } from '@/renderer/utils';
|
import { constrainSidebarWidth } from '@/renderer/utils';
|
||||||
import { Playerbar } from '../features/player';
|
import { Playerbar } from '../features/player';
|
||||||
import { Sidebar } from '../features/sidebar';
|
import { Sidebar } from '../features/sidebar/components/sidebar';
|
||||||
|
|
||||||
const Layout = styled.div`
|
const Layout = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -72,7 +73,8 @@ const ResizeHandle = styled.div<{
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const DefaultLayout = () => {
|
export const DefaultLayout = () => {
|
||||||
const [leftSidebarWidth, setLeftSidebarWidth] = useState('170px');
|
const sidebar = useAppStore((state) => state.sidebar);
|
||||||
|
const setSidebar = useAppStore((state) => state.setSidebar);
|
||||||
|
|
||||||
const sidebarRef = useRef(null);
|
const sidebarRef = useRef(null);
|
||||||
const [isResizing, setIsResizing] = useState(false);
|
const [isResizing, setIsResizing] = useState(false);
|
||||||
@@ -88,12 +90,11 @@ export const DefaultLayout = () => {
|
|||||||
const resize = useCallback(
|
const resize = useCallback(
|
||||||
(mouseMoveEvent) => {
|
(mouseMoveEvent) => {
|
||||||
if (isResizing) {
|
if (isResizing) {
|
||||||
setLeftSidebarWidth(
|
const width = `${constrainSidebarWidth(mouseMoveEvent.clientX)}px`;
|
||||||
`${constrainSidebarWidth(mouseMoveEvent.clientX)}px`
|
setSidebar({ leftWidth: width });
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[isResizing]
|
[isResizing, setSidebar]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -107,47 +108,10 @@ export const DefaultLayout = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <LayoutContainer>
|
|
||||||
<TitlebarContainer size={30}>
|
|
||||||
<Titlebar />
|
|
||||||
</TitlebarContainer>
|
|
||||||
<Space.Fill>
|
|
||||||
<LeftSidebar
|
|
||||||
handleRender={(props) => (
|
|
||||||
<ResizeHandle placement="right" {...props} />
|
|
||||||
)}
|
|
||||||
maximumSize={400}
|
|
||||||
minimumSize={175}
|
|
||||||
size={175}
|
|
||||||
>
|
|
||||||
<Sidebar />
|
|
||||||
</LeftSidebar>
|
|
||||||
<RightSidebar
|
|
||||||
scrollable
|
|
||||||
handleRender={(props) => (
|
|
||||||
<ResizeHandle placement="left" {...props} />
|
|
||||||
)}
|
|
||||||
maximumSize={800}
|
|
||||||
size={300}
|
|
||||||
>
|
|
||||||
<QueueTable />
|
|
||||||
</RightSidebar>
|
|
||||||
<Space.Fill scrollable>
|
|
||||||
<AnimatePresence exitBeforeEnter>
|
|
||||||
<ContentContainer key={location.pathname}>
|
|
||||||
<Outlet />
|
|
||||||
</ContentContainer>
|
|
||||||
</AnimatePresence>
|
|
||||||
</Space.Fill>
|
|
||||||
</Space.Fill>
|
|
||||||
<PlayerbarContainer size={90}>
|
|
||||||
<Playerbar />
|
|
||||||
</PlayerbarContainer>
|
|
||||||
</LayoutContainer> */}
|
|
||||||
<Layout>
|
<Layout>
|
||||||
<TitlebarContainer>
|
<TitlebarContainer>
|
||||||
<Titlebar />
|
<Titlebar />
|
||||||
<Menu withinPortal zIndex="999999">
|
<Menu withinPortal>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
<Button />
|
<Button />
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
@@ -157,7 +121,7 @@ export const DefaultLayout = () => {
|
|||||||
</Menu.Dropdown>
|
</Menu.Dropdown>
|
||||||
</Menu>
|
</Menu>
|
||||||
</TitlebarContainer>
|
</TitlebarContainer>
|
||||||
<MainContainer leftSidebarWidth={leftSidebarWidth}>
|
<MainContainer leftSidebarWidth={sidebar.leftWidth}>
|
||||||
<SidebarContainer>
|
<SidebarContainer>
|
||||||
<ResizeHandle
|
<ResizeHandle
|
||||||
ref={sidebarRef}
|
ref={sidebarRef}
|
||||||
|
|||||||
Reference in New Issue
Block a user