Skip to content

Commit 084dfbf

Browse files
updates
1 parent 6278f83 commit 084dfbf

5 files changed

Lines changed: 30 additions & 29 deletions

File tree

src/App.jsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,8 @@ addTheme("/themes/fun.css");
5151

5252
import ContextMenu from './components/Contextmenu.jsx';
5353

54-
const removeServer = (src) => {
55-
setState("servers", servers =>
56-
servers.filter(server => server.src !== src)
57-
);
58-
};
59-
6054
import "./core/ContextMenuDefs.jsx"
6155

62-
const [firstBarWidth, setFirstBarWidth] = createSignal(260);
63-
export const [thirdBarWidth, setThirdBarWidth] = createSignal(320);
6456

6557

6658
const defaultState = {
@@ -91,6 +83,8 @@ const defaultState = {
9183
loadAttachments: "all",
9284
showNicknames: "nickname",
9385
blockedMessages: "collapsed",
86+
firstBarWidth: 260,
87+
thirdBarWidth: 320,
9488
}
9589
};
9690
export const [unreads, setUnreads] = createStore({
@@ -138,6 +132,23 @@ export const [state, setState] = createStore({
138132
},
139133
});
140134

135+
136+
const [firstBarWidth, setFirstBarWidth] = createSignal(
137+
state.settings.firstBarWidth
138+
);
139+
140+
export const [thirdBarWidth, setThirdBarWidth] = createSignal(
141+
state.settings.thirdBarWidth
142+
);
143+
144+
createEffect(() => {
145+
setState("settings", "firstBarWidth", firstBarWidth());
146+
});
147+
148+
createEffect(() => {
149+
setState("settings", "thirdBarWidth", thirdBarWidth());
150+
});
151+
141152
export var tempState = {};
142153
window.tempState = tempState
143154
window.state = state;

src/components/channelCache.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// channelCache.js
2-
// LRU cache (max 3 entries) for preloaded channel message data.
3-
// Entries not "active" (i.e. not the currently open channel) expire after 1 minute.
4-
51
const MAX_ENTRIES = 3;
62
const BACKGROUND_TTL_MS = 60_000;
73

8-
const cache = new Map(); // key: channelName -> { data, timer, fetchedAt }
9-
const inflight = new Map(); // key: channelName -> Promise (dedupe concurrent preloads)
4+
const cache = new Map();
5+
const inflight = new Map();
106

117
function touch(name) {
12-
// refresh recency order for LRU
138
const entry = cache.get(name);
149
if (!entry) return;
1510
cache.delete(name);
@@ -32,8 +27,6 @@ function clearEntryTimer(name) {
3227
}
3328
}
3429

35-
// Starts (or restarts) the background expiry timer for a channel.
36-
// Call armExpiry(name) whenever a channel becomes "background" (not the active one).
3730
function armExpiry(name) {
3831
const entry = cache.get(name);
3932
if (!entry) return;
@@ -45,8 +38,6 @@ function armExpiry(name) {
4538
}, BACKGROUND_TTL_MS);
4639
}
4740

48-
// Call disarmExpiry(name) when a channel becomes the active one, so it won't expire
49-
// while in use.
5041
function disarmExpiry(name) {
5142
clearEntryTimer(name);
5243
}
@@ -62,7 +53,6 @@ export function hasCached(name) {
6253
return cache.has(name);
6354
}
6455

65-
// fetcher: () => Promise<data> — only called if not already cached/inflight
6656
export async function preloadChannel(name, fetcher) {
6757
if (!name) return null;
6858

@@ -86,7 +76,6 @@ export async function preloadChannel(name, fetcher) {
8676
});
8777

8878
evictIfNeeded();
89-
// newly preloaded channels start as "background" until made active
9079
armExpiry(name);
9180

9281
return data;

src/components/serverSidebar/ChannelList.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ function isImageSrc(src) {
7979
return typeof src === "string" && src.trim().length > 0;
8080
}
8181

82-
// props.preloadChannel(channelName) should call your data-fetch (e.g. sendRequest
83-
// + await the response, or read from an existing store) and resolve with the
84-
// payload to cache. Passed down from the parent so ChannelList stays decoupled
85-
// from the connection layer.
8682
export default function ChannelList(props) {
8783
const cleanupFns = [];
8884

@@ -98,7 +94,6 @@ export default function ChannelList(props) {
9894
}
9995

10096
function handleSelect(channelName) {
101-
// previous active channel becomes background and starts its TTL
10297
if (props.currentChannel && props.currentChannel !== channelName) {
10398
markBackground(props.currentChannel);
10499
}

src/core/ContextMenuDefs.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ import {
1010
HiOutlineChatBubbleBottomCenterText
1111
} from "solid-icons/hi";
1212
import SystemContextMenu from '../components/Systemcontextmenu.js';
13+
import { setState } from "../App.jsx";
14+
15+
const removeServer = (src) => {
16+
setState("servers", servers =>
17+
servers.filter(server => server.src !== src)
18+
);
19+
};
1320

1421
SystemContextMenu.init([
1522
{

src/styles/index.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ nav button.active {
105105
}
106106

107107
.text_box_wrapper {
108-
margin-top: .5em;
109108
gap: 0;
110109
}
111110

@@ -192,7 +191,7 @@ opacity: 1;
192191
cursor: pointer;
193192

194193
&:hover {
195-
background-color: var(--bg-three);
194+
background-color: var(--diff-two);
196195
opacity: 1;
197196
}
198197

@@ -1458,7 +1457,7 @@ img.big_emoji {
14581457
height: 1.2em;
14591458
white-space: nowrap;
14601459
color: var(--fg-dim);
1461-
margin: .2em .8em;
1460+
margin: .5em .8em;
14621461
margin-top: 0;
14631462
align-items: center;
14641463
position: relative;

0 commit comments

Comments
 (0)