瀏覽代碼

refac: chat controls size

Timothy J. Baek 7 月之前
父節點
當前提交
8fc178ae91
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 5 5
      src/lib/components/chat/Chat.svelte
  2. 1 3
      src/lib/components/chat/ChatControls.svelte

+ 5 - 5
src/lib/components/chat/Chat.svelte

@@ -289,11 +289,11 @@
 			if (controlPane && !$mobile) {
 			if (controlPane && !$mobile) {
 				try {
 				try {
 					if (value) {
 					if (value) {
-						controlPane.resize(
-							parseInt(localStorage.getItem('chat-controls-size') || '35')
-								? parseInt(localStorage.getItem('chat-controls-size') || '35')
-								: 35
-						);
+						const currentSize = controlPane.getSize();
+
+						if (currentSize === 0) {
+							controlPane.resize(parseInt(localStorage?.chatControlsSize ?? '30'));
+						}
 					} else {
 					} else {
 						controlPane.resize(0);
 						controlPane.resize(0);
 					}
 					}

+ 1 - 3
src/lib/components/chat/ChatControls.svelte

@@ -123,9 +123,7 @@
 		<Pane
 		<Pane
 			bind:pane
 			bind:pane
 			defaultSize={$showControls
 			defaultSize={$showControls
-				? parseInt(localStorage.getItem('chat-controls-size') || '35')
-					? parseInt(localStorage.getItem('chat-controls-size') || '35')
-					: 35
+				? controlPane.resize(parseInt(localStorage?.chatControlsSize ?? '30'))
 				: 0}
 				: 0}
 			onResize={(size) => {
 			onResize={(size) => {
 				if (size === 0) {
 				if (size === 0) {