🔨 chore: remove sidebar auto collapse

This commit is contained in:
倏昱 2023-04-23 18:28:54 +08:00
parent 51dc2aaa60
commit 906be79144
2 changed files with 73 additions and 81 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,9 @@
import { DraggablePanel } from '@/components'
import { WebuiSetting } from '@/components/Header/Setting'
import { useAppStore } from '@/store'
import { useLocalStorageState } from 'ahooks'
import { useResponsive } from 'antd-style'
import React, { CSSProperties, useEffect } from 'react'
import styled from 'styled-components'
import { shallow } from 'zustand/shallow'
import PromptGroup from './PromptGroup'
const SidebarView = styled.div`
@ -23,21 +21,15 @@ interface SidebarProps {
const Sidebar: React.FC<SidebarProps> = ({ children, loading, style }) => {
const { mobile } = useResponsive()
const [currentTab] = useAppStore((st) => [st.currentTab], shallow)
const [setting] = useLocalStorageState<WebuiSetting>('SD-KITCHEN-SETTING')
const [expand, setExpand] = useLocalStorageState<boolean>('SD-KITCHEN-SIDEBAR', {
defaultValue: true,
})
useEffect(() => {
if (mobile) setExpand(false)
}, [])
useEffect(() => {
if (currentTab && !['tab_txt2img', 'tab_img2img'].includes(currentTab)) {
setExpand(false)
}
}, [currentTab])
return (
<DraggablePanel
maxHeight