Skip to content

Commit

Permalink
smol changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GregTCLTK committed Jan 21, 2024
1 parent f2a068d commit db2152f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pages/_legacy/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export function showPreviewImage(x: Drop) {
: Image(artwork, "A Placeholder Artwork.");
}

export async function loadImage(x: Drop) {
async function loadImage(x: Drop) {
const cache = await fileCache();
if (await cache.has(`image-preview-${x.artwork}`))
return await cache.get(`image-preview-${x.artwork}`)!;
Expand Down
8 changes: 5 additions & 3 deletions pages/hosting/views/dialogs/deleteFileDialog.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Box, Button, Color, Horizontal, Label, SheetDialog, Spacer, Vertical } from "webgen/mod.ts";
import { Box, Button, Color, Grid, Label, SheetDialog, Vertical } from "webgen/mod.ts";
import { sheetStack } from "../../../_legacy/helper.ts";

export function deleteFileDialog() {
const response = Promise.withResolvers<boolean>();
const dialog = SheetDialog(sheetStack, "Are you sure?",
Vertical(
Box(Label("Deleting this File will result in data loss.\nAfter this point there is no going back.")).setMargin("0 0 1.5rem")),
Horizontal(
Spacer(),
Grid(
Button("Cancel").onClick(() => dialog.close()),
Button("Delete").onClick(() => {
response.resolve(true);
dialog.close();
}).setColor(Color.Critical)
)
.setGap(".5rem")
.setJustify("end")
.setRawColumns("auto max-content")
);

dialog.setOnClose(() => response.resolve(false));
Expand Down
8 changes: 5 additions & 3 deletions pages/hosting/views/dialogs/editFileDialog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import loader from "https://esm.sh/@monaco-editor/loader@1.4.0";
import { editor } from "https://esm.sh/monaco-editor@0.44.0/esm/vs/editor/editor.api.js";
import { delay } from "std/async/delay.ts";
import { Box, Button, Cache, Custom, Horizontal, Label, MIcon, SheetDialog, Spacer, Vertical, asRef, lazyInit, refMerge } from "webgen/mod.ts";
import { Box, Button, Cache, Custom, Grid, Label, MIcon, SheetDialog, Vertical, asRef, lazyInit, refMerge } from "webgen/mod.ts";
import { sheetStack } from "../../../_legacy/helper.ts";
import { uploadFile } from "../../loading.ts";
import './editFileDialog.css';
Expand Down Expand Up @@ -83,8 +83,7 @@ export const editFileDialog = SheetDialog(sheetStack, "Edit File",
Cache("monaco-editor", () => createMonacoEditor(),
(type, data) => type === "cache" ? Label("Loading Editor") : data ?? Box()
),
Horizontal(
Spacer(),
Grid(
Button("Cancel").onClick(() => editFileDialog.close()),
Button("Save").onClick(async () => {
if (editFileDownloading.getValue())
Expand All @@ -101,5 +100,8 @@ export const editFileDialog = SheetDialog(sheetStack, "Edit File",
editFileDialog.close();
}),
)
.setGap(".5rem")
.setJustify("end")
.setRawColumns("auto max-content")
)
);
24 changes: 10 additions & 14 deletions pages/shared/restSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,16 @@ export const API = {
.then(json<Drop[]>())
.catch(reject);
},
user: (id: string) => {
return fetch(`${API.BASE_URL}admin/drops?user=${id}`, {
headers: headers(API.getToken())
})
.then(json<Drop[]>())
.catch(reject);
},
id: (id: string) => {
return fetch(`${API.BASE_URL}admin/drops/${id}`, {
headers: headers(API.getToken())
})
.then(json<Drop>())
.catch(reject);
},
user: (id: string) => fetch(`${API.BASE_URL}admin/drops?user=${id}`, {
headers: headers(API.getToken())
})
.then(json<Drop[]>())
.catch(reject),
id: (id: string) => fetch(`${API.BASE_URL}admin/drops/${id}`, {
headers: headers(API.getToken())
})
.then(json<Drop>())
.catch(reject),
},
payouts: {
list: () => fetch(`${API.BASE_URL}admin/payouts`, {
Expand Down
1 change: 1 addition & 0 deletions pages/user/settings.personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export function ChangePersonal() {
if (data) await API.user.setMe.post(state)
.then(stupidErrorAlert);
await forceRefreshToken();
location.reload();
state.validationState = undefined;
})),
).setGap("20px").addClass("limited-width");
Expand Down

0 comments on commit db2152f

Please sign in to comment.