Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Aug 13, 2024
1 parent debca9a commit 75ee8f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pages/admin/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ export const state = asState({
oauth: <External<OAuthApp[]> | "loading"> "loading",
files: <External<File[]> | "loading"> "loading",
wallets: <External<Wallet[]> | "loading"> "loading",
search: <({ _index: "transcripts"; _source: Transcript } | { _index: "drops"; _source: Drop } | { _index: "servers"; _source: Server } | { _index: "users"; _source: ProfileData } | { _index: "files"; _source: File } | { _index: "none" } | { _index: "searching" })[]>[],
search: <SearchResult[]> [],
searchStats: <External<{ total: number; took: number }> | "loading"> "loading",
});

export type SearchResult = { _index: "transcripts"; _source: Transcript } | { _index: "drops"; _source: Drop } | { _index: "servers"; _source: Server } | { _index: "users"; _source: ProfileData } | { _index: "files"; _source: File } | { _index: "none" } | { _index: "searching" };

export const reviewState = asState({
// deno-lint-ignore no-explicit-any
drop: <Drop & { user: ProfileData; events: any[] } | undefined> undefined,
Expand Down
6 changes: 3 additions & 3 deletions pages/admin/views/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { sumOf } from "@std/collections";
import loader from "https://esm.sh/@monaco-editor/[email protected]";
import { API, HeavyList, loadMore, Navigation, placeholder, stupidErrorAlert } from "shared/mod.ts";
import { asRef, asState, Box, Button, Color, Custom, Entry, Grid, Horizontal, isMobile, Label, lazy, ref, SheetDialog, Spacer, Table, TextInput, Vertical } from "webgen/mod.ts";
import { Drop, DropType, File, Server, Transcript } from "../../../spec/music.ts";
import { activeUser, ProfileData, sheetStack, showProfilePicture } from "../../shared/helper.ts";
import { DropType } from "../../../spec/music.ts";
import { activeUser, sheetStack, showProfilePicture } from "../../shared/helper.ts";
import { upload } from "../loading.ts";
import { state } from "../state.ts";
import { ReviewEntry } from "./entryReview.ts";
Expand Down Expand Up @@ -54,7 +54,7 @@ export const adminMenu = Navigation({
state.searchStats = asState({ total: elasticresults.hits.total.value, took: elasticresults.took });
}, 1000)),
state.$searchStats.map((it) => (it === "loading" || it.status === "rejected") ? Box() : Label(`${state.$searchStats.getValue().took}ms | ${state.$searchStats.getValue().total} Entries`)).asRefComponent(),
HeavyList(state.$search.map((it) => it as ({ _index: "transcripts"; _source: Transcript } | { _index: "drops"; _source: Drop } | { _index: "servers"; _source: Server } | { _index: "users"; _source: ProfileData } | { _index: "files"; _source: File } | { _index: "user-events"; _source: object } | { _index: "none" } | { _index: "searching" })[]), (it) => {
HeavyList(state.$search, (it) => {
switch (it._index) {
case "transcripts":
return Entry(
Expand Down

0 comments on commit 75ee8f1

Please sign in to comment.