summaryrefslogtreecommitdiff
path: root/lib/VNDB/VN/Page.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/VN/Page.pm')
-rw-r--r--lib/VNDB/VN/Page.pm57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/VNDB/VN/Page.pm b/lib/VNDB/VN/Page.pm
new file mode 100644
index 00000000..59ea0ddb
--- /dev/null
+++ b/lib/VNDB/VN/Page.pm
@@ -0,0 +1,57 @@
+package VNDB::VN::Page;
+
+use strict;
+use warnings;
+use TUWF ':Html5';
+use VNDB::Auth;
+use VNDB::VN::DB;
+
+my $VID_RE = qr{v(?<vid>[1-9][0-9]*)};
+
+sub header {
+ Div class => 'header', sub {
+ Div class => 'header__nav', sub {
+ Div class => 'header__logo', 'vndb';
+ Div class => 'header__menu', 'Games';
+ };
+ Div class => 'header__user', auth->username || 'not logged in';
+ };
+}
+
+sub framework {
+ my $body = shift;
+ Html sub {
+ Head sub {
+ Meta name => 'viewport', content => 'width=device-width, initial-scale=1, shrink-to-fit=no';
+ Title 'VNDBv3 test';
+ Link rel => 'stylesheet', href => '/f/style.css';
+ };
+ Body sub {
+ Div class => 'container', sub {
+ header;
+ };
+ $body->();
+ };
+ };
+ Pre style => 'font-size: 8px', sub {
+ tuwf->dbCommit; # Hack to measure the commit time
+ Txt "SQL Queries:\n";
+ for (@{ tuwf->{_TUWF}{DB}{queries} }) {
+ my($sql, undef, $time) = @$_;
+ Txt sprintf " [%6.2fms] %s\n", $time*1000, $sql;
+ }
+ } if tuwf->debug;
+}
+
+
+
+
+
+TUWF::get qr{/$VID_RE}, sub {
+ framework sub {
+ Txt tuwf->capture('vid');
+ use Data::Dumper 'Dumper';
+ #Pre Dumper [ VNDB::VN::DB::get(undef, {hidden => 1}) ];
+ Pre Dumper [ VNDB::DB::entry(v => 1) ];
+ };
+};