mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 09:01:17 -08:00
actually done with the spaces i think
This commit is contained in:
1 parent
fa1f386df1
commit
ea7fe5d776
11 files changed
+50
-5
No files matched your search
@@ -30,6 +30,8 @@ export function CallChatView() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={threadSidebarWidth}
|
||||
setSidebarWidth={setThreadSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
rightSided
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -303,6 +303,8 @@ export function MembersDrawer({ room, members }: MembersDrawerProps) {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={memberSidebarWidth}
|
||||
setSidebarWidth={setMemberSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
rightSided
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -454,6 +454,8 @@ export function ThreadBrowser({ room, onOpenThread, onClose, overlay }: ThreadBr
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={threadSidebarWidth}
|
||||
setSidebarWidth={setThreadSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
rightSided
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -761,6 +761,8 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={threadSidebarWidth}
|
||||
setSidebarWidth={setThreadSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
rightSided
|
||||
/>
|
||||
)}
|
||||
@@ -827,6 +829,8 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
|
||||
setCurWidth={setCurHeight}
|
||||
sidebarWidth={threadRootHeight}
|
||||
setSidebarWidth={setThreadRootHeight}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
topSided
|
||||
/>
|
||||
<div
|
||||
|
||||
@@ -261,6 +261,8 @@ export function WidgetsDrawer({ room }: WidgetsDrawerProps) {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={widgetSidebarWidth}
|
||||
setSidebarWidth={setWidgetSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
rightSided
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -351,6 +351,8 @@ export function Direct() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={roomSidebarWidth}
|
||||
setSidebarWidth={setRoomSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -285,6 +285,8 @@ export function Explore() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={roomSidebarWidth}
|
||||
setSidebarWidth={setRoomSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -391,6 +391,8 @@ export function Home() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={roomSidebarWidth}
|
||||
setSidebarWidth={setRoomSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -109,6 +109,8 @@ export function Inbox() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={roomSidebarWidth}
|
||||
setSidebarWidth={setRoomSidebarWidth}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -9,12 +9,20 @@ export function SidebarResizer({
|
||||
sidebarWidth,
|
||||
setSidebarWidth,
|
||||
setCurWidth,
|
||||
minValue,
|
||||
maxValue,
|
||||
instep,
|
||||
outstep,
|
||||
rightSided,
|
||||
topSided,
|
||||
}: {
|
||||
sidebarWidth: number;
|
||||
setSidebarWidth: (arg0: number) => void;
|
||||
setCurWidth?: Dispatch<SetStateAction<number>>;
|
||||
minValue: number;
|
||||
maxValue: number;
|
||||
instep?: number;
|
||||
outstep?: number;
|
||||
rightSided?: boolean;
|
||||
topSided?: boolean;
|
||||
}) {
|
||||
@@ -26,12 +34,19 @@ export function SidebarResizer({
|
||||
|
||||
useEffect(() => {
|
||||
const change = rightSided ? -(oldX - newX) : oldX - newX;
|
||||
if (change) setSidebarWidth(Math.min(Math.max(sidebarWidth - change, 50), 1200));
|
||||
let newValue = Math.min(Math.max(sidebarWidth - change, minValue), maxValue);
|
||||
if (instep && outstep && newValue > instep && newValue < outstep)
|
||||
newValue = newValue > (instep + outstep) / 2 ? outstep : instep;
|
||||
|
||||
if (change) setSidebarWidth(newValue);
|
||||
}, [newX]);
|
||||
|
||||
useEffect(() => {
|
||||
const change = rightSided ? -(oldX - interimX) : oldX - interimX;
|
||||
if (change && setCurWidth) setCurWidth(Math.min(Math.max(sidebarWidth - change, 50), 1200));
|
||||
let newValue = Math.min(Math.max(sidebarWidth - change, minValue), maxValue);
|
||||
if (instep && outstep && newValue > instep && newValue < outstep)
|
||||
newValue = newValue > (instep + outstep) / 2 ? outstep : instep;
|
||||
if (change && setCurWidth) setCurWidth(newValue);
|
||||
}, [interimX]);
|
||||
|
||||
const onPointerMove = useCallback((e: PointerEvent) => {
|
||||
|
||||
@@ -270,8 +270,13 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageNavHeader>
|
||||
<Box alignItems="Center" grow="Yes" gap="300">
|
||||
<PageNavHeader
|
||||
style={{
|
||||
paddingLeft: hideText ? toRem(4) : toRem(16),
|
||||
paddingRight: hideText ? toRem(2) : '0',
|
||||
}}
|
||||
>
|
||||
<Box alignItems="Center" grow={hideText ? 'No' : 'Yes'} gap="300">
|
||||
{hideText ? (
|
||||
<Avatar size={hideText ? undefined : '200'} radii="400">
|
||||
<RoomAvatar
|
||||
@@ -754,7 +759,7 @@ export function Space() {
|
||||
|
||||
const screenSize = useScreenSizeContext();
|
||||
const isMobile = mobileOrTablet() || screenSize === ScreenSize.Mobile;
|
||||
const hideText = curWidth < 64 && !isMobile;
|
||||
const hideText = curWidth <= 80 && !isMobile;
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -821,6 +826,7 @@ export function Space() {
|
||||
style={{
|
||||
height: virtualizer.getTotalSize(),
|
||||
position: 'relative',
|
||||
overflow: 'clip',
|
||||
}}
|
||||
>
|
||||
{virtualizedItems.map((vItem) => {
|
||||
@@ -932,6 +938,10 @@ export function Space() {
|
||||
setCurWidth={setCurWidth}
|
||||
sidebarWidth={roomSidebarWidth}
|
||||
setSidebarWidth={setRoomSidebarWidth}
|
||||
instep={80}
|
||||
outstep={180}
|
||||
minValue={50}
|
||||
maxValue={1200}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user