chore(cleanup): remove dead code and add android build to gitignore

This commit is contained in:
plebeius
2026-02-24 15:15:38 +08:00
parent b5d9db8a66
commit 5bd1dc0e71
11 changed files with 8 additions and 275 deletions
+4 -1
View File
@@ -172,4 +172,7 @@ yarn-error.log*
# Upload selector smoke probe (report-only, local/CI triage)
scripts/upload-selectors-smoke-report.json
scripts/upload-selectors-smoke-snapshots/
scripts/upload-selectors-smoke-snapshots/
# Android build artifacts
android/app/build/
@@ -1,13 +0,0 @@
// Types for boardsbar edit modal component
export interface BoardCodeCheckbox {
code: string;
label: string;
checked: boolean;
}
export interface SubscriptionCheckbox {
address: string;
displayName: string;
checked: boolean;
}
-1
View File
@@ -1 +0,0 @@
export { default } from './edit-menu';
-1
View File
@@ -1 +0,0 @@
export { default } from './error-display';
-83
View File
@@ -1,86 +1,3 @@
/**
* Mapping of 4chan board codes to 5chan directory names
* Used for displaying board links in the boardsbar
*/
export const BOARD_CODE_TO_DIRECTORY: Record<string, string> = {
a: 'Anime & Manga',
b: 'Random',
c: 'Anime/Cute',
d: 'Mecha',
e: 'Ecchi',
f: 'Flash',
g: 'Technology',
gif: 'Adult GIF',
h: 'Hentai',
hr: 'High Resolution',
k: 'Traditional Games',
m: 'Mecha',
o: 'Auto',
p: 'Photography',
r: 'Request',
s: 'Sexy Beautiful Women',
t: 'Torrents',
u: 'Yuri',
v: 'Video Games',
vg: 'Video Game Generals',
vm: 'Video Games/Multiplayer',
vmg: 'Video Games/Mobile',
vr: 'Retro Games',
vrpg: 'Video Games/RPG',
vst: 'Video Games/Strategy',
w: 'Anime/Wallpapers',
wg: 'Worksafe GIF',
i: 'Oekaki',
ic: 'Artwork/Critique',
r9k: 'ROBOT9001',
s5s: 'Shit 5chan Says',
vip: 'Very Important Posts',
cm: 'Cute/Male',
hm: 'Handsome Men',
lgbt: 'LGBT',
y: 'Yaoi',
'3': '3DCG',
aco: 'Anime/Cute',
adv: 'Advertisement',
an: 'Animals & Nature',
bant: 'International/Random',
biz: 'Business & Finance',
cgl: 'Cosplay & EGL',
ck: 'Food & Cooking',
co: 'Comics & Cartoons',
diy: 'Do-It-Yourself',
fa: 'Fashion',
fit: 'Fitness',
gd: 'Graphic Design',
hc: 'Hardcore',
his: 'History & Humanities',
int: 'International',
jp: 'Otaku Culture',
lit: 'Literature',
mlp: 'Pony',
mu: 'Music',
n: 'Transportation',
news: 'Current News',
out: 'Outdoors',
po: 'Papercraft & Origami',
pol: 'Politically Incorrect',
pw: 'Professional Wrestling',
qst: 'Quests',
sci: 'Science & Math',
soc: 'Cams & Meetups',
sp: 'Sports',
tg: 'Traditional Games',
toy: 'Toys',
trv: 'Travel',
tv: 'Television & Film',
vp: 'Pokémon',
vt: 'Virtual YouTubers',
wsg: 'Worksafe Requests',
wsr: 'Worksafe Requests',
x: 'Adult Cartoons',
xs: 'Extreme Sports',
};
/**
* Board code groups matching 4chan's bracket structure
* Each group represents boards displayed together in brackets
-73
View File
@@ -1,73 +0,0 @@
import { useMemo } from 'react';
import { useLocation, useParams } from 'react-router-dom';
import useThemeStore from '../stores/use-theme-store';
import { useDirectories } from './use-directories';
import { isAllView, isHomeView, isNotFoundView, isPendingPostView, isSubscriptionsView, isModView } from '../lib/utils/view-utils';
import { getSubplebbitAddress } from '../lib/utils/route-utils';
import { useAccountComment } from '@plebbit/plebbit-react-hooks';
const useInitialTheme = (pendingPostSubplebbitAddress?: string) => {
const location = useLocation();
const { boardIdentifier, accountCommentIndex } = useParams<{ boardIdentifier: string; accountCommentIndex?: string }>();
const commentIndex = accountCommentIndex ? parseInt(accountCommentIndex) : undefined;
const pendingPost = useAccountComment({ commentIndex });
// Subscribe to the actual themes data, not just functions
const themes = useThemeStore((state) => state.themes);
const directories = useDirectories();
const params = useParams();
const isInHomeView = isHomeView(location.pathname);
const isInNotFoundView = isNotFoundView(location.pathname, params);
const isInAllView = isAllView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
const isInModView = isModView(location.pathname);
const isInPendingPostView = isPendingPostView(location.pathname, params);
const paramsSubplebbitAddress = boardIdentifier ? getSubplebbitAddress(boardIdentifier, directories) : undefined;
const initialTheme = useMemo(() => {
let theme = 'yotsuba';
if (isInPendingPostView) {
const subplebbitAddress = pendingPostSubplebbitAddress || pendingPost?.subplebbitAddress;
if (subplebbitAddress) {
const community = directories.find((s) => s.address === subplebbitAddress);
if (community?.nsfw) {
theme = themes.nsfw || 'yotsuba';
} else {
theme = themes.sfw || 'yotsuba-b';
}
} else {
theme = 'yotsuba';
}
} else if (isInAllView || isInSubscriptionsView || isInModView) {
theme = themes.sfw || 'yotsuba-b';
} else if (isInHomeView || isInNotFoundView) {
theme = 'yotsuba';
} else if (paramsSubplebbitAddress) {
const community = directories.find((s) => s.address === paramsSubplebbitAddress);
if (community?.nsfw) {
theme = themes.nsfw || 'yotsuba';
} else {
theme = themes.sfw || 'yotsuba-b';
}
}
return theme;
}, [
isInPendingPostView,
isInAllView,
isInSubscriptionsView,
isInModView,
isInHomeView,
isInNotFoundView,
paramsSubplebbitAddress,
themes,
directories,
pendingPostSubplebbitAddress,
pendingPost,
]);
return initialTheme;
};
export default useInitialTheme;
-50
View File
@@ -1,50 +0,0 @@
import { useCallback, useState } from 'react';
import useIsMobile from './use-is-mobile';
import useSelectedTextStore from '../stores/use-selected-text-store';
const useReplyModal = () => {
const [showReplyModal, setShowReplyModal] = useState(false);
const [activeCid, setActiveCid] = useState<string | null>(null);
const [parentNumber, setParentNumber] = useState<number | null>(null);
const [threadCid, setThreadCid] = useState<string | null>(null);
const [subplebbitAddress, setSubplebbitAddress] = useState<string | null>(null);
const { resetSelectedText, setSelectedText } = useSelectedTextStore();
// on mobile, the css position is absolute instead of fixed, so we need to calculate the top position
const isMobile = useIsMobile();
const [scrollY, setScrollY] = useState<number>(0);
const closeModal = useCallback(() => {
resetSelectedText();
setActiveCid(null);
setParentNumber(null);
setShowReplyModal(false);
}, [resetSelectedText, setActiveCid, setShowReplyModal]);
const getSelectedText = () => {
let text = document.getSelection()?.toString();
if (text) setSelectedText(`>${text}\n`);
};
const openReplyModal = (parentCid: string, parentNum: number | undefined, postCid: string, subplebbitAddress: string) => {
getSelectedText();
if (isMobile) {
const currentScrollY = window.scrollY;
setScrollY(currentScrollY);
}
if (activeCid && activeCid !== parentCid) {
return;
}
setActiveCid(parentCid);
setParentNumber(parentNum ?? null);
setThreadCid(postCid);
setShowReplyModal(true);
setSubplebbitAddress(subplebbitAddress);
};
return { activeCid, parentNumber, threadCid, closeModal, openReplyModal, scrollY, showReplyModal, subplebbitAddress };
};
export default useReplyModal;
-14
View File
@@ -29,17 +29,3 @@ export interface ProviderAttempt {
/** Selectors tried (e.g. when file input / submit not found); from plugin or parsed from error */
matchedSelectors?: string[];
}
/** Successful upload result */
export interface ProviderSuccess {
provider: ProviderId;
url: string;
fileName: string;
attempts?: ProviderAttempt[];
}
/** Aggregate error when all providers fail */
export interface ProviderAggregateError {
attempts: ProviderAttempt[];
message: string;
}
-4
View File
@@ -7,10 +7,6 @@ interface SnowOptions {
// Add this new variable to track manual override
let manualSnowOverride: boolean | null = null;
export const setManualSnowOverride = (value: boolean): void => {
manualSnowOverride = value;
};
export const initSnow = ({ flakeCount }: SnowOptions): void => {
const randomRange = (min: number, max: number): number => {
min = Math.ceil(min);
-31
View File
@@ -1,31 +0,0 @@
import {
isAllView,
isBoardView,
isCatalogView,
isHomeView,
isModView,
isModQueueView,
isPendingPostView,
isPostPageView,
isSettingsView,
isSubscriptionsView,
isNotFoundView,
ParamsType,
} from './view-utils';
import { formatUserIDForDisplay } from './string-utils';
export {
isAllView,
isBoardView,
isCatalogView,
isHomeView,
isModView,
isModQueueView,
isPendingPostView,
isPostPageView,
isSettingsView,
isSubscriptionsView,
isNotFoundView,
formatUserIDForDisplay,
};
export type { ParamsType };
+4 -4
View File
@@ -20,7 +20,7 @@ let cachedAddressToDirectoryMap: Map<string, string> | null = null;
* Create a map from directory codes to community addresses
* Uses caching to avoid recreating the map when communities array hasn't changed
*/
export const getDirectoryToAddressMap = (communities: DirectoryCommunity[]): Map<string, string> => {
const getDirectoryToAddressMap = (communities: DirectoryCommunity[]): Map<string, string> => {
// Check if we can use cached map (same array reference)
if (cachedDirectoryToAddressMap && cachedCommunitiesForDirectory === communities) {
return cachedDirectoryToAddressMap;
@@ -46,7 +46,7 @@ export const getDirectoryToAddressMap = (communities: DirectoryCommunity[]): Map
* Create a map from community addresses to directory codes
* Uses caching to avoid recreating the map when communities array hasn't changed
*/
export const getAddressToDirectoryMap = (communities: DirectoryCommunity[]): Map<string, string> => {
const getAddressToDirectoryMap = (communities: DirectoryCommunity[]): Map<string, string> => {
// Check if we can use cached map (same array reference)
if (cachedAddressToDirectoryMap && cachedCommunitiesForAddress === communities) {
return cachedAddressToDirectoryMap;
@@ -139,9 +139,9 @@ export const isModQueueRoute = (pathname: string): boolean => {
};
/** Page numbers 110 for board feed pagination */
export const BOARD_PAGE_REGEX = /^([1-9]|10)$/;
const BOARD_PAGE_REGEX = /^([1-9]|10)$/;
export const isBoardFeedPageNumber = (segment: string): boolean => BOARD_PAGE_REGEX.test(segment);
const isBoardFeedPageNumber = (segment: string): boolean => BOARD_PAGE_REGEX.test(segment);
/** Internal: check if segment is a multiboard root (all, subs, mod) */
function isMultiboardRoot(segment: string): boolean {