Skip to content

Commit 5e45db3

Browse files
committed
* change the height of .post-nav(-expand)? from fixed height: 100vh to dynamicly max-height: 100dvh @ <PostNav>
* replace some pattern of `v === a || v === b` or `v !== a && v !== b` with `Array.includes()` following https://en.wikipedia.org/wiki/De_Morgan%27s_laws except whose need type narrowing: microsoft/TypeScript#51678 * remove all unused `eslint-disable` directives for rule `compat/compat` since 037ccd9 upgraded target browser versions @ fe
1 parent fa2f0ab commit 5e45db3

7 files changed

Lines changed: 10 additions & 9 deletions

File tree

fe/src/components/post/Nav.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<nav
3-
class="post-nav col p-0 vh-100 sticky-top border-0"
3+
class="post-nav col p-0 sticky-top border-0"
44
:class="{ 'd-none': !isPostNavExpanded }" :aria-expanded="isPostNavExpanded">
55
<AMenu
66
v-model:selectedKeys="selectedThreads" v-model:openKeys="expandedPages" @click="selectThread($event)"
@@ -33,7 +33,7 @@
3333
'border-start': isPostNavExpanded,
3434
'border-end': !isPostNavExpanded
3535
}"
36-
class="post-nav-expand col-auto align-items-center d-flex vh-100 sticky-top border-light-subtle">
36+
class="post-nav-expand col-auto align-items-center d-flex sticky-top border-light-subtle">
3737
<a
3838
v-if="!hydrationStore.isHydratingOrSSR"
3939
@click="togglePostNavExpanded()" class="text-primary">
@@ -175,6 +175,9 @@ watch(viewportTopmostPost, async (to, from) => {
175175
.post-nav {
176176
overflow: hidden;
177177
}
178+
.post-nav, .post-nav-expand {
179+
max-height: 100dvh;
180+
}
178181
.post-nav:hover {
179182
overflow-y: auto;
180183
}

fe/src/components/post/queryForm/QueryForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
</option>
158158
</select>
159159
</template>
160-
<template v-if="p.name === 'authorGender' || p.name === 'latestReplierGender'">
160+
<template v-if="['authorGender', 'latestReplierGender'].includes(p.name)">
161161
<select v-model="p.value" class="form-control flex-grow-0 w-25">
162162
<option value="0">未设置(显示为男)</option>
163163
<option value="1">男 ♂</option>

fe/src/components/user/QueryForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const paramsDefaultValue = {
4444
} as const;
4545
const omitDefaultParamsValue = (params: Record<string, LocationQueryValueRaw>) => {
4646
_.each(paramsDefaultValue, (value, param) => {
47-
if (params[param] === value || params[param] === undefined)
47+
if ([value, undefined].includes(params[param]))
4848
Reflect.deleteProperty(params, param);
4949
});
5050

fe/src/stores/relativeTime.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export const useRelativeTimeStore = defineStore('relativeTime', () => {
3838
return oldVisibility;
3939
};
4040
const intersectionObserver = 'IntersectionObserver' in globalThis
41-
// eslint-disable-next-line compat/compat
4241
? new IntersectionObserver(entries => {
4342
_.orderBy(entries, entry => entry.time).forEach(entry => { // https://github.com/vueuse/vueuse/issues/4197
4443
const visibility = getElementVisibility(entry.target);

fe/src/stores/viewportTopmostPost.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const useViewportTopmostPostStore = defineStore('viewportTopmostPost', ()
1010
return { cursor, tid: Number(tid), pid: undefinedOr(pid, Number) };
1111
};
1212
type UsingImplement = Promise<(stickyTitleEl: Ref<HTMLElement | undefined | null>, newTopmostPost: TopmostPost, topOffset?: number) => void>;
13+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1314
const usingScrollState = async (): UsingImplement => {
1415
const stuckPosts = ref<TopmostPost[]>([]); // https://github.com/w3c/csswg-drafts/issues/12302
1516
type Record = Parameters<ConstructorParameters<typeof StyleObserver>[0]>[0];
@@ -62,9 +63,7 @@ export const useViewportTopmostPostStore = defineStore('viewportTopmostPost', ()
6263
// https://stackoverflow.com/questions/16302483/event-to-detect-when-positionsticky-is-triggered
6364
// https://stackoverflow.com/questions/54807535/intersection-observer-api-observe-the-center-of-the-viewport
6465
// https://web.archive.org/web/20240111160426/https://wilsotobianco.com/experiments/intersection-observer-playground/
65-
// eslint-disable-next-line compat/compat
6666
const observerForZeroTopOffset = new IntersectionObserver(onIntersect, { rootMargin: '0px 0px -100% 0px' });
67-
// eslint-disable-next-line compat/compat
6867
let observerForNonZeroTopOffset = new IntersectionObserver(noop);
6968

7069
return (stickyTitleEl, newTopmostPost, topOffset = 0) => {

fe/src/utils/post/queryForm/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const getQueryFormDeps = () => {
113113

114114
// check params required post types, index query doesn't restrict on post types
115115
invalidParamsIndex.value = []; // reset to prevent duplicate indexes
116-
if (currentQueryType.value !== 'postID' && currentQueryType.value !== 'fid') {
116+
if (!['postID', 'fid'].includes(currentQueryType.value)) {
117117
/** we don't {@link Array.filter()} here for post types validate */
118118
params.value.map(clearParamDefaultValue).forEach((param, paramIndex) => {
119119
if (param?.name === undefined || param.value === undefined) {

fe/src/utils/post/renderer/list/scroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const scrollToPostListItemByRoute = (route: RouteLocationNormalized) => {
5050
const el = document.querySelector(scrollPosition.el);
5151
if (el === null)
5252
return;
53-
// eslint-disable-next-line compat/compat
53+
5454
requestIdleCallback(function retry(deadline) {
5555
if (deadline.timeRemaining() > 0)
5656
scrollToPostListItem(el);

0 commit comments

Comments
 (0)