From 762a4fd51e2d6ce4c85b9cbd7b8abff3331767e9 Mon Sep 17 00:00:00 2001 From: mitteneer Date: Fri, 2 May 2025 10:00:47 -0400 Subject: [PATCH] Create partial for view agnostic table --- src/app/views/partials/_newtable.zmpl | 55 +++++++++++++++++++++++++++ src/types.zig | 8 ++++ 2 files changed, 63 insertions(+) create mode 100644 src/app/views/partials/_newtable.zmpl diff --git a/src/app/views/partials/_newtable.zmpl b/src/app/views/partials/_newtable.zmpl new file mode 100644 index 0000000..bee43c1 --- /dev/null +++ b/src/app/views/partials/_newtable.zmpl @@ -0,0 +1,55 @@ +@args table_data *ZmplValue, table_headers: []enum{Song, Album, Artist, Scrobbles, Date} + + + + +@zig { + for (table_headers) |header| { + switch (header) { + .Artist => { + + }, + inline else => |other| { + const h = @tagName(other); + + }, + } + } +} + + + +@zig { + for (table_data) |data| { + + for (table_header) |header| { + switch (header) { + .Song => { + + }, + .Album => { + + }, + .Artist => { + + }, + .Scrobbles => { + + }, + .Date =>{ + + } + }; + } + } +} + +
Artist(s){{h}}
+ {{data.name}} + + {{data.name}} + + @for (data.get("artist_info").?) |ai| { + {{ai.name}} + } + {{data.scrobbles}}{{data.date}}
\ No newline at end of file diff --git a/src/types.zig b/src/types.zig index 704adc0..2574610 100644 --- a/src/types.zig +++ b/src/types.zig @@ -61,3 +61,11 @@ pub const Rule = struct { pub const Rules = struct { rules: []const Rule, }; + +pub const Headers = []enum { + Song, + Album, + Artist, + Scrobbles, + Date, +};