diff --git a/views/components/feed.latte b/components/feed.latte similarity index 100% rename from views/components/feed.latte rename to components/feed.latte diff --git a/views/components/following_tags.latte b/components/following_tags.latte similarity index 100% rename from views/components/following_tags.latte rename to components/following_tags.latte diff --git a/views/components/footer.latte b/components/footer.latte similarity index 100% rename from views/components/footer.latte rename to components/footer.latte diff --git a/views/components/head.latte b/components/head.latte similarity index 100% rename from views/components/head.latte rename to components/head.latte diff --git a/views/components/navbar.latte b/components/navbar.latte similarity index 100% rename from views/components/navbar.latte rename to components/navbar.latte diff --git a/views/components/settings/following.latte b/components/settings/following.latte similarity index 100% rename from views/components/settings/following.latte rename to components/settings/following.latte diff --git a/views/components/settings/proxy.latte b/components/settings/proxy.latte similarity index 100% rename from views/components/settings/proxy.latte rename to components/settings/proxy.latte diff --git a/layouts/default.latte b/layouts/default.latte new file mode 100644 index 0000000..05e2f39 --- /dev/null +++ b/layouts/default.latte @@ -0,0 +1,21 @@ + + + +{include '../components/head.latte'} + + + {include '../components/navbar.latte'} +
+
+
+ {block header}{/block} +
+
+
+
+ {block content}{/block} +
+ {include '../components/footer.latte'} + + {block extra}{/block} + diff --git a/layouts/hero.latte b/layouts/hero.latte new file mode 100644 index 0000000..8092d07 --- /dev/null +++ b/layouts/hero.latte @@ -0,0 +1,23 @@ + + + +{include '../components/head.latte'} + + +
+
+ {include '../components/navbar.latte'} +
+
+
+ {block content}{/block} +
+
+
+ {include '../components/footer.latte'} +
+
+ {block extra}{/block} + + + diff --git a/routes/following.php b/routes/following.php index b189553..3735045 100644 --- a/routes/following.php +++ b/routes/following.php @@ -28,5 +28,9 @@ Route::add('/following', function () { 'hasMore' => false ]; $latte = Misc::latte(); - $latte->render(Misc::getView('following'), ['following' => $following, 'feed' => $feed]); + $latte->render(Misc::getView('following'), [ + 'following' => $following, + 'feed' => $feed, + 'title' => 'Following' + ]); }); diff --git a/routes/index.php b/routes/index.php index ab70b02..bed9369 100644 --- a/routes/index.php +++ b/routes/index.php @@ -8,12 +8,12 @@ use Helpers\Error; Route::add('/', function () { $latte = Misc::latte(); - $latte->render(Misc::getView('home')); + $latte->render(Misc::getView('home'), ['title' => 'Home']); }); Route::add('/about', function () { $latte = Misc::latte(); - $latte->render(Misc::getView('about')); + $latte->render(Misc::getView('about'), ['title' => 'About']); }); Route::add("/trending", function () { @@ -25,7 +25,10 @@ Route::add("/trending", function () { $feed = $api->getTrendingFeed($cursor); if ($feed->meta->success) { $latte = Misc::latte(); - $latte->render(Misc::getView('trending'), ['feed' => $feed]); + $latte->render(Misc::getView('trending'), [ + 'feed' => $feed, + 'title' => 'Trending' + ]); } else { Error::show($feed->meta); } @@ -44,7 +47,10 @@ Route::add("/@([^/]+)", function (string $username) { return 'Private account detected! Not supported'; } $latte = Misc::latte(); - $latte->render(Misc::getView('user'), ['feed' => $feed]); + $latte->render(Misc::getView('user'), [ + 'feed' => $feed, + 'title' => $feed->info->detail->user->nickname + ]); } else { Error::show($feed->meta); } @@ -55,7 +61,10 @@ Route::add('/video/([^/]+)', function (string $video_id) { $item = $api->getVideoByID($video_id); if ($item->meta->success) { $latte = Misc::latte(); - $latte->render(Misc::getView('video'), ['item' => $item]); + $latte->render(Misc::getView('video'), [ + 'item' => $item, + 'title' => $item->info->detail->user->nickname + ]); } else { Error::show($item->meta); } @@ -71,7 +80,10 @@ Route::add('/music/([^/]+)', function (string $music_id) { $feed = $api->getMusicFeed($music_id, $cursor); if ($feed->meta->success) { $latte = Misc::latte(); - $latte->render(Misc::getView('music'), ['feed' => $feed]); + $latte->render(Misc::getView('music'), [ + 'feed' => $feed, + 'title' => 'Music' + ]); } else { Error::show($feed->meta); } @@ -86,7 +98,10 @@ Route::add('/tag/(\w+)', function (string $name) { $feed = $api->getChallengeFeed($name, $cursor); if ($feed->meta->success) { $latte = Misc::latte(); - $latte->render(Misc::getView('tag'), ['feed' => $feed]); + $latte->render(Misc::getView('tag'), [ + 'feed' => $feed, + 'title' => 'Tag' + ]); } else { Error::show($feed->meta); } diff --git a/routes/settings.php b/routes/settings.php index 6fbee96..a3296bf 100644 --- a/routes/settings.php +++ b/routes/settings.php @@ -7,7 +7,11 @@ use Steampixel\Route; Route::add("/settings", function () { $latte = Misc::latte(); - $latte->render(Misc::getView('settings'), ["proxy_elements" => Settings::PROXY, "following" => Following::get()]); + $latte->render(Misc::getView('settings'), [ + "proxy_elements" => Settings::PROXY, + "following" => Following::get(), + "title" => "Settings" + ]); }); Route::add("/settings/proxy", function () { diff --git a/views/about.latte b/views/about.latte index ca02cd1..e8c9028 100644 --- a/views/about.latte +++ b/views/about.latte @@ -1,20 +1,9 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'About'} +{block header} +

About

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

About

-
-
-
-
-

TODO

-
- {include 'components/footer.latte'} - - +{block content} +

TODO

+{/block} diff --git a/views/error.latte b/views/error.latte index 6a0c2d4..687e861 100644 --- a/views/error.latte +++ b/views/error.latte @@ -1,25 +1,9 @@ - - +{layout '../layouts/hero.latte'} -{include 'components/head.latte', title: 'ERROR'} - - -
-
- {include 'components/navbar.latte'} -
-
-
-

There was an error processing your request!

-

HTTP Code: {$error->http_code}

- {if $error->tiktok_code} -

API error code {$error->tiktok_code} ({$error->tiktok_msg})

- {/if} -
-
-
- {include 'components/footer.latte'} -
-
- - +{block content} +

There was an error processing your request!

+

HTTP Code: {$error->http_code}

+{if $error->tiktok_code} +

API error code {$error->tiktok_code} ({$error->tiktok_msg})

+{/if} +{/block} diff --git a/views/following.latte b/views/following.latte index 53b7e51..3256286 100644 --- a/views/following.latte +++ b/views/following.latte @@ -1,24 +1,13 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'Following'} +{block header} +

Following

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

Following

-
-
-
-
-

Following:

- {include 'components/following_tags.latte'} -

You can add/remove follows on settings

-
+{block content} +

Following:

+ {include '../components/following_tags.latte'} +

You can add/remove follows on settings


- {include 'components/feed.latte'} - {include 'components/footer.latte'} - - + {include '../components/feed.latte'} +{/block} diff --git a/views/home.latte b/views/home.latte index d2eb4f4..15940db 100644 --- a/views/home.latte +++ b/views/home.latte @@ -1,74 +1,60 @@ - - +{layout '../layouts/hero.latte'} -{include 'components/head.latte', title: 'Home'} +{block content} +

Welcome to ProxiTok!

+

An alternative open source frontend for TikTok

+

Search user:

+
+
+
+ +
+
+ +
+
+
+
+

Search video by id:

+
+
+
+ +
+
+ +
+
+
+
+

Search tag:

+
+
+
+ +
+
+ +
+
+
+
+

Search music videos by id:

+
+
+
+ +
+
+ +
+
+
+
+

Trending:

+Go +{/block} - -
-
- {include 'components/navbar.latte'} -
-
-
-

Welcome to ProxiTok!

-

An alternative open source frontend for TikTok

-

Search user:

-
-
-
- -
-
- -
-
-
-
-

Search video by id:

-
-
-
- -
-
- -
-
-
-
-

Search tag:

-
-
-
- -
-
- -
-
-
-
-

Search music videos by id:

-
-
-
- -
-
- -
-
-
-
-

Trending:

- Go -
-
-
- {include 'components/footer.latte'} -
-
+{block extra} - - - +{/block} diff --git a/views/music.latte b/views/music.latte index 6aebd9d..cd9ec73 100644 --- a/views/music.latte +++ b/views/music.latte @@ -1,20 +1,11 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'Music'} +{block header} +

{$feed->info->detail->music->title}

+

{$feed->info->detail->music->desc}

+

Videos: {number($feed->info->detail->stats->videoCount)}

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

{$feed->info->detail->music->title}

-

{$feed->info->detail->music->desc}

-

Videos: {number($feed->info->detail->stats->videoCount)}

-
-
-
- {include 'components/feed.latte'} - {include 'components/footer.latte'} - - +{block content} + {include '../components/feed.latte'} +{/block} diff --git a/views/settings.latte b/views/settings.latte index e82efb6..87ad311 100644 --- a/views/settings.latte +++ b/views/settings.latte @@ -1,26 +1,15 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'Settings'} +{block header} +

Settings

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

Settings

-
-
-
-
- -

Proxy

- {include 'components/settings/proxy.latte'} -
- -

Following

- {include 'components/settings/following.latte'} -
- {include 'components/footer.latte'} - - +{block content} + +

Proxy

+{include '../components/settings/proxy.latte'} +
+ +

Following

+{include '../components/settings/following.latte'} +{/block} diff --git a/views/tag.latte b/views/tag.latte index 7b35e7f..b954450 100644 --- a/views/tag.latte +++ b/views/tag.latte @@ -1,20 +1,11 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'Tag'} +{block header} +

{$feed->info->detail->challenge->title}

+

{$feed->info->detail->challenge->desc}

+

Videos: {number($feed->info->detail->stats->videoCount)} / Views: {number($feed->info->detail->stats->viewCount)}

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

{$feed->info->detail->challenge->title}

-

{$feed->info->detail->challenge->desc}

-

Videos: {number($feed->info->detail->stats->videoCount)} / Views: {number($feed->info->detail->stats->viewCount)}

-
-
-
- {include 'components/feed.latte'} - {include 'components/footer.latte'} - - +{block content} + {include '../components/feed.latte'} +{/block} diff --git a/views/trending.latte b/views/trending.latte index a4d7e9e..1f89f63 100644 --- a/views/trending.latte +++ b/views/trending.latte @@ -1,18 +1,9 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: 'Trending'} +{block header} +

Trending

+{/block} - - {include 'components/navbar.latte'} -
-
-
-

Trending

-
-
-
- {include 'components/feed.latte'} - {include 'components/footer.latte'} - - +{block content} + {include '../components/feed.latte'} +{/block} diff --git a/views/user.latte b/views/user.latte index fda2025..a84061d 100644 --- a/views/user.latte +++ b/views/user.latte @@ -1,24 +1,15 @@ - - +{layout '../layouts/default.latte'} -{include 'components/head.latte', title: $feed->info->detail->user->nickname} +{block header} +
+ +
+

{$feed->info->detail->user->uniqueId}'s profile

+

{$feed->info->detail->user->signature}

+

Following: {number($feed->info->detail->stats->followingCount)} / Followers: {number($feed->info->detail->stats->followerCount)}

+

Hearts: {number($feed->info->detail->stats->heartCount)} / Videos: {$feed->info->detail->stats->videoCount}

+{/block} - - {include 'components/navbar.latte'} -
-
-
-
- -
-

{$feed->info->detail->user->uniqueId}'s profile

-

{$feed->info->detail->user->signature}

-

Following: {number($feed->info->detail->stats->followingCount)} / Followers: {number($feed->info->detail->stats->followerCount)}

-

Hearts: {number($feed->info->detail->stats->heartCount)} / Videos: {$feed->info->detail->stats->videoCount}

-
-
-
- {include 'components/feed.latte'} - {include 'components/footer.latte'} - - +{block content} + {include '../components/feed.latte'} +{/block} diff --git a/views/video.latte b/views/video.latte index fcc4f8d..e11488f 100644 --- a/views/video.latte +++ b/views/video.latte @@ -1,35 +1,21 @@ - - +{layout '../layouts/hero.latte'} -{include 'components/head.latte', title: $item->info->detail->user->nickname} - - -
-
- {include 'components/navbar.latte'} +{block content} +
+
+ +
+
+
+

Video by {$item->info->detail->user->uniqueId}

+

{$item->items[0]->desc}

+

Played {number($item->info->detail->stats->playCount)} times

+

Shared {number($item->info->detail->stats->shareCount)} times / {number($item->info->detail->stats->commentCount)} comments

+
+ Download video +

{$item->items[0]->music->title}

+
-
-
-
- -
-
-
-

Video by {$item->info->detail->user->uniqueId}

-

{$item->items[0]->desc}

-

Played {number($item->info->detail->stats->playCount)} times

-

Shared {number($item->info->detail->stats->shareCount)} times / {number($item->info->detail->stats->commentCount)} comments

-
- Download video -

{$item->items[0]->music->title}

- -
-
-
-
-
- {include 'components/footer.latte'} -
-
- - + + +{/block}