Skip to content

Commit

Permalink
use song language instead of country
Browse files Browse the repository at this point in the history
  • Loading branch information
greg6775 committed Aug 17, 2024
1 parent 2d81775 commit e916cd1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pages/admin/review.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API, createActionList, createBreadcrumb, createTagList, LoadingSpinner, Navigation, stupidErrorAlert } from "shared/mod.ts";
import { BasicLabel, Body, Button, ButtonStyle, Color, Empty, Entry, Grid, Horizontal, isMobile, Label, Spacer, Vertical, WebGen } from "webgen/mod.ts";
import { Body, Button, ButtonStyle, Color, Empty, Entry, Grid, Horizontal, isMobile, Label, Spacer, Vertical, WebGen } from "webgen/mod.ts";
import "../../assets/css/main.css";
import "../../assets/css/music.css";
import { DynaNavigation } from "../../components/nav.ts";
Expand Down Expand Up @@ -120,7 +120,7 @@ sheetStack.setDefault(Vertical(
: LoadingSpinner()
).asRefComponent(),
Vertical(
BasicLabel({ title: "", subtitle: "Drop History" }),
Label("Drop History", "h1").setTextAlign("center"),
reviewState.$drop.map((drop) =>
drop
? Vertical(
Expand Down
5 changes: 2 additions & 3 deletions pages/music/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export function uploadSongToDrop(songs: Reference<Song[]>, artists: ArtistRef[],
_id: uploadId,
title: cleanedUpTitle,
artists,
// TODO: country should be real country
country: language,
language,
instrumental: false,
explicit: false,
primaryGenre,
Expand All @@ -41,7 +40,7 @@ export function uploadSongToDrop(songs: Reference<Song[]>, artists: ArtistRef[],
const song = await API.music.songs.create({
title: cleanedUpTitle,
artists,
country: language,
language,
instrumental: false,
explicit: false,
primaryGenre,
Expand Down
11 changes: 5 additions & 6 deletions pages/music/views/table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getSecondary, getYearList, ProfilePicture, sheetStack } from "shared/helper.ts";
import { API, Progress, stupidErrorAlert, Table2 } from "shared/mod.ts";
import { asRef, asState, Box, Button, Checkbox, Color, DropDownInput, Grid, Horizontal, IconButton, InlineTextInput, Label, MIcon, Reference, SheetDialog, Spacer, TextInput } from "webgen/mod.ts";
import genres from "../../../data/genres.json" with { type: "json" };
import language from "../../../data/language.json" with { type: "json" };
import { Artist, ArtistRef, ArtistTypes, Song } from "../../../spec/music.ts";
import { getSecondary, getYearList, ProfilePicture, sheetStack } from "../../shared/helper.ts";
import "./table.css";

export function ManageSongs(songs: Reference<Song[]>, uploadingSongs: Reference<{ [uploadId: string]: number }[]>, primaryGenre: string, artistList?: Artist[]) {
Expand Down Expand Up @@ -33,11 +33,10 @@ export function ManageSongs(songs: Reference<Song[]>, uploadingSongs: Reference<
.ref(data)
.addClass("low-level");
})
//TODO: create real country.json
.addColumn("Country", (song) => {
const data = asRef(song.country);
data.listen((x, oldVal) => (oldVal != undefined) && songs.updateItem(song, { ...song, country: x }));
return DropDownInput("Country", Object.keys(language))
.addColumn("Language", (song) => {
const data = asRef(song.language);
data.listen((x, oldVal) => (oldVal != undefined) && songs.updateItem(song, { ...song, language: x }));
return DropDownInput("Language", Object.keys(language))
.setRender((key) => language[<keyof typeof language> key])
.ref(data)
.addClass("low-level");
Expand Down
6 changes: 3 additions & 3 deletions spec/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export const song = zod.object({
primaryGenre: zod.string(),
secondaryGenre: zod.string(),
year: zod.number(),
country: zod.string(),
//TODO: Add in frontend mby
language: zod.string().optional(),
//add in frontend with additional info sheet
country: zod.string().optional(),
language: zod.string(),
explicit: zod.boolean(),
instrumental: zod.boolean(),
file: zod.string({ required_error: "a Song is missing its file." }),
Expand Down

0 comments on commit e916cd1

Please sign in to comment.