Skip to content

Commit

Permalink
remove old code and adjust wording
Browse files Browse the repository at this point in the history
  • Loading branch information
GregTCLTK committed Mar 17, 2024
1 parent 0d39423 commit 04c703f
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 169 deletions.
21 changes: 3 additions & 18 deletions pages/admin/dialog.ts
@@ -1,27 +1,12 @@
import { API } from "shared/mod.ts";
import { Box, Button, ButtonStyle, CenterV, Checkbox, Custom, Empty, Horizontal, Image, Label, SheetDialog, Spacer, Validate, Vertical, asState, createElement, css, getErrorMessage } from "webgen/mod.ts";
import { API, LoadingSpinner } from "shared/mod.ts";
import { Box, Button, ButtonStyle, CenterV, Checkbox, Custom, Empty, Horizontal, Label, SheetDialog, Spacer, Validate, Vertical, asState, createElement, css, getErrorMessage } from "webgen/mod.ts";
import { zod } from "webgen/zod.ts";
import reviewTexts from "../../data/reviewTexts.json" with { type: "json" };
import { Drop, ReviewResponse } from "../../spec/music.ts";
import { sheetStack } from "../_legacy/helper.ts";
import { clientRender, dropPatternMatching, rawTemplate, render } from "./email.ts";

document.adoptedStyleSheets.push(css`
.footer {
gap: 0.5rem;
}
.test .wimage{
height: 40rem;
width: 100%;
background-color: transparent;
}
.test .wimage .loading-wheel {
z-index: 0;
}
.dialog-me {
min-height: 40rem;
}
.winput.textarea {
height: unset;
}
Expand Down Expand Up @@ -109,7 +94,7 @@ export const ApproveDialog = SheetDialog(sheetStack, "Approve Drop",
ApproveDialog.close();
})
).setGap()
) : Box(Image({ type: "loading" }, "Loading...")).addClass("test")
) : LoadingSpinner()
)
.setMargin("0 0 var(--gap)")
).asRefComponent()
Expand Down
1 change: 0 additions & 1 deletion pages/admin/email.css
@@ -1,5 +1,4 @@
.emailPreview {
width: 100%;
box-sizing: border-box;
border: none;
border-radius: 5px;
Expand Down
2 changes: 0 additions & 2 deletions pages/admin/loading.ts
Expand Up @@ -11,10 +11,8 @@ export async function refreshState() {
(async () => state.groups = await API.admin.groups.list())(),
(async () => state.payouts = await API.admin.payouts.list())(),
(async () => state.files = await API.admin.files.list())(),
(async () => state.servers = await API.admin.servers.list())(),
(async () => state.wallets = await API.admin.wallets.list())(),
(async () => state.oauth = await API.oauth.list())(),
(async () => state.transcripts = await API.admin.transcripts.list())(),
]);
}

Expand Down
8 changes: 1 addition & 7 deletions pages/admin/state.ts
Expand Up @@ -7,19 +7,13 @@ export const state = asState({
drops: {
reviews: <External<Drop[]> | "loading">"loading",
publishing: <External<Drop[]> | "loading">"loading",
published: <External<Drop[]> | "loading">"loading",
private: <External<Drop[]> | "loading">"loading",
rejected: <External<Drop[]> | "loading">"loading",
drafts: <External<Drop[]> | "loading">"loading",
},
groups: <External<Group[]> | "loading">"loading",
payouts: <External<Payout[][]> | "loading">"loading",
oauth: <External<OAuthApp[]> | "loading">"loading",
files: <External<File[]> | "loading">"loading",
servers: <External<Server[]> | "loading">"loading",
wallets: <External<Wallet[]> | "loading">"loading",
transcripts: <External<Transcript[]> | "loading">"loading",
search: <({ type: "transcript", val: Transcript} | {type: "drop", val: Drop} | {type: "server", val: Server} | {type: "user", val: ProfileData})[]>[],
search: <({ type: "transcript", val: Transcript; } | { type: "drop", val: Drop; } | { type: "server", val: Server; } | { type: "user", val: ProfileData; })[]>[],
});

export const reviewState = asState({
Expand Down
24 changes: 5 additions & 19 deletions pages/admin/views/menu.ts
Expand Up @@ -9,7 +9,7 @@ import { upload } from "../loading.ts";
import { state } from "../state.ts";
import { ReviewEntry } from "./entryReview.ts";
import { GroupEntry } from "./entryUser.ts";
import { entryFile, entryOAuth, entryWallet, transcriptMenu } from "./list.ts";
import { entryFile, entryOAuth, entryWallet } from "./list.ts";

const lazyMonaco = lazyInit(() => loader.init());

Expand Down Expand Up @@ -61,7 +61,7 @@ export const adminMenu = Navigation({
}
);
case "drop":
return ReviewEntry(it.val)
return ReviewEntry(it.val);
case "server":
return Entry(
{
Expand All @@ -84,8 +84,8 @@ export const adminMenu = Navigation({
theme: "vs-dark",
automaticLayout: true,
});


SheetDialog(sheetStack, "User", Custom(box).setHeight("800px").setWidth("1200px")).open();
})
.addPrefix(showProfilePicture(it.val));
Expand Down Expand Up @@ -185,27 +185,13 @@ export const adminMenu = Navigation({
children: [ HeavyList(state.$files, entryFile)
]
},
{
id: "servers",
title: ref`Minecraft Servers`,
children: [
// HeavyList(state.$servers, it => entryServer(State(it) as StateHandler<Server>, true))
// .enablePaging((offset, limit) => loadMore(state.$servers, () => API.admin.servers.list(offset, limit)))
]
},
{
id: "wallets",
title: ref`Wallets`,
children: [ HeavyList(state.$wallets, entryWallet)
.enablePaging((offset, limit) => loadMore(state.$wallets, () => API.admin.wallets.list(offset, limit)))
]
},
{
id: "transcripts",
title: ref`Tickets`,
children:
state.$transcripts.map(it => transcriptMenu(it))
},
}
]
})
.addClass(
Expand Down
28 changes: 12 additions & 16 deletions pages/music-landing/main.ts
Expand Up @@ -258,7 +258,7 @@ Body(
.addClass("key-icon", "red"),
Label("Lowest Cut")
.setFontWeight("bold"),
Label("With our free plan, we only take a 3% cut as Royalties."),
Label("With our free plan, we only take a 3% cut of your revenue."),
)
.setGap("13px")
.setJustifyItems("start")
Expand All @@ -268,7 +268,7 @@ Body(
.addClass("key-icon", "green"),
Label("Global")
.setFontWeight("bold"),
Label("We support multiple distributors, without any extra cost for you.")
Label("We support all major and many smaller stores, without any extra cost for you.")
)
.setGap("13px")
.setJustifyItems("start")
Expand All @@ -278,19 +278,18 @@ Body(
.addClass("key-icon", "blue"),
Label("Unlimited")
.setFontWeight("bold"),
Label("No hard limits. You can manage as many Drops or Artists as you want.")
Label("No hard limits. You can manage as many Drops and Artists as you want.")
)
.setGap("13px")
.setJustifyItems("start")
.setAlignContent("start"),
isMobileKeyFeatures.map(mobile => !mobile ? Empty()
: Box(LinkButton("Drop your Music", "/c/music")
.setBorderRadius("complete")
.setPadding("2px 25px")
.addClass("orange-bg")
).addClass("call-to-action")
)
.asRefComponent()
isMobileKeyFeatures.map(mobile => mobile ? Box(LinkButton("Drop your Music", "/c/music")
.setBorderRadius("complete")
.setPadding("2px 25px")
.addClass("orange-bg")
).addClass("call-to-action")
: Empty()
).asRefComponent()
)
.setGap()
.setDynamicColumns(10)
Expand Down Expand Up @@ -358,9 +357,6 @@ Body(
.setPadding("95px 0 95px 0")
.setGap("21px")
).setMaxWidth("680px"),
FullWidthSection(
Footer()
)
)
.setMaxWidth("1230px")
FullWidthSection(Footer())
).setMaxWidth("1230px")
);
124 changes: 63 additions & 61 deletions pages/music/views/menu.ts
@@ -1,5 +1,5 @@
import { API, Chart, count, HeavyList, LoadingSpinner, Navigation, placeholder, stupidErrorAlert } from "shared/mod.ts";
import { Button, Entry, Grid, isMobile, ref } from "webgen/mod.ts";
import { Button, Entry, Grid, isMobile, MediaQuery, ref } from "webgen/mod.ts";
import { DropType } from "../../../spec/music.ts";
import { activeUser } from "../../_legacy/helper.ts";
import { state } from "../state.ts";
Expand Down Expand Up @@ -43,74 +43,76 @@ export const musicMenu = Navigation({
id: "payouts",
title: ref`Payouts ${count(state.$payouts)}`,
children: state.$payouts.map(payouts => payouts == "loading" ? [ LoadingSpinner() ] : [
Grid(
Chart({
type: 'bar',
data: {
labels: payouts.map(row => row.period.split(" to ")[ 0 ].split("Period ")[ 1 ].split("-").slice(0, 2).join("-")).reverse(),
datasets: [
{
label: 'Revenue by Month',
data: payouts.map(row => row.moneythisperiod.replace("£ ", "")).reverse(),
}
]
},
options: {
plugins: {
title: {
display: true,
text: 'Revenue by Month',
color: 'white'
},
legend: {
display: false
}
MediaQuery("(max-width: 700px)", (small) =>
Grid(
Chart({
type: 'bar',
data: {
labels: payouts.map(row => row.period.split(" to ")[ 0 ].split("Period ")[ 1 ].split("-").slice(0, 2).join("-")).reverse(),
datasets: [
{
label: 'Revenue by Month',
data: payouts.map(row => row.moneythisperiod.replace("£ ", "")).reverse(),
}
]
},
responsive: true,
scales: {
x: {
stacked: true,
options: {
plugins: {
title: {
display: true,
text: 'Revenue by Month',
color: 'white'
},
legend: {
display: false
}
},
y: {
stacked: true
responsive: true,
scales: {
x: {
stacked: true,
},
y: {
stacked: true
}
}
}
}
}),
Chart({
type: 'bar',
data: {
labels: payouts.map(row => row.period.split(" to ")[ 0 ].split("Period ")[ 1 ].split("-").slice(0, 2).join("-")).reverse(),
datasets: [
{
label: 'Streams by Month',
data: payouts.map(row => row.streams).reverse()
}
]
},
options: {
plugins: {
title: {
display: true,
text: 'Streams by Month',
color: 'white'
},
legend: {
display: false
}
}),
Chart({
type: 'bar',
data: {
labels: payouts.map(row => row.period.split(" to ")[ 0 ].split("Period ")[ 1 ].split("-").slice(0, 2).join("-")).reverse(),
datasets: [
{
label: 'Streams by Month',
data: payouts.map(row => row.streams).reverse()
}
]
},
responsive: true,
scales: {
x: {
stacked: true,
options: {
plugins: {
title: {
display: true,
text: 'Streams by Month',
color: 'white'
},
legend: {
display: false
}
},
y: {
stacked: true
responsive: true,
scales: {
x: {
stacked: true,
},
y: {
stacked: true
}
}
}
}
})
).setEvenColumns(2),
})
).setEvenColumns(small ? 1 : 2)
),
HeavyList(state.$payouts, (x) => Entry({
title: x.period,
subtitle: x.moneythisperiod,
Expand Down
1 change: 0 additions & 1 deletion pages/shared/components.ts
Expand Up @@ -9,7 +9,6 @@ export const Chart = <TType extends ChartType = ChartType, TData = DefaultDataPo
(config: ChartConfiguration<TType, TData, TLabel> | ChartConfigurationCustomTypesPerDataset<TType, TData, TLabel>) => {
const canvas = document.createElement("canvas");

console.log(config);
lazyChart().then(chartjs => new chartjs.Chart(canvas, config));

return Box(Custom(canvas).addClass("chart"));
Expand Down

0 comments on commit 04c703f

Please sign in to comment.