Skip to content

Commit 15681ef

Browse files
committed
Theme update
1 parent df2f603 commit 15681ef

96 files changed

Lines changed: 1219 additions & 1188 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Api;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Models\Registry;
7+
use Illuminate\Http\JsonResponse;
8+
use Illuminate\Http\Request;
9+
10+
class ThemeController extends Controller
11+
{
12+
public function index(Request $request): JsonResponse
13+
{
14+
$themes = Registry::query()
15+
->themes()
16+
->get()
17+
->map(fn ($theme) => $this->formatTheme($theme));
18+
19+
return response()->json($themes);
20+
}
21+
22+
public function show(string $name): JsonResponse
23+
{
24+
$theme = Registry::query()
25+
->themes()
26+
->where('name', $name)
27+
->first();
28+
29+
if (! $theme) {
30+
return response()->json(['error' => 'Theme not found'], 404);
31+
}
32+
33+
return response()->json($this->formatTheme($theme));
34+
}
35+
36+
private function formatTheme(Registry $theme): array
37+
{
38+
return [
39+
'name' => $theme->name,
40+
'title' => $theme->title,
41+
'description' => $theme->meta['description'] ?? null,
42+
'author' => $theme->author,
43+
'baseColor' => $theme->baseColor,
44+
'style' => $theme->style,
45+
'font' => $theme->font,
46+
'cssVars' => $theme->css_vars,
47+
'css' => $theme->css,
48+
'registryDependencies' => $theme->registryDependencies ?? [],
49+
'meta' => $theme->meta,
50+
];
51+
}
52+
}

app/Http/Controllers/HomePageIndexController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Models\Registry;
56
use Illuminate\Http\Request;
67
use Inertia\Inertia;
78
use Laravel\Fortify\Features;
@@ -13,8 +14,12 @@ class HomePageIndexController extends Controller
1314
*/
1415
public function __invoke(Request $request)
1516
{
17+
$fonts = Registry::query()->fonts()->get();
18+
19+
1620
return Inertia::render('home', [
1721
'canRegister' => Features::enabled(Features::registration()),
22+
'fonts' => $fonts,
1823
]);
1924
}
2025
}

app/Models/Registry.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,33 @@ class Registry extends Model
3333
'categories' => 'array',
3434
];
3535

36-
3736
public function scopeThemes($query)
3837
{
3938
return $query->where('type', 'registry:theme');
4039
}
4140

41+
public function scopeFonts($query)
42+
{
43+
return $query->where('type', 'registry:font');
44+
}
45+
46+
public function scopeLib($query)
47+
{
48+
return $query->where('type', 'registry:lib');
49+
}
50+
51+
public function scopeUi($query)
52+
{
53+
return $query->where('type', 'registry:ui');
54+
}
4255

56+
public function scopeComponent($query)
57+
{
58+
return $query->where('type', 'registry:component');
59+
}
60+
61+
protected function scopeSearch($query, $search)
62+
{
63+
return $query->where('name', 'like', "%{$search}%");
64+
}
4365
}

public/build/assets/animations-D5BwWnE2.js renamed to public/build/assets/animations-VFDFVAOB.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-4-wBhzFY.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

public/build/assets/app-9JFo9ByE.js

Lines changed: 115 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-DDT63lz2.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-V9AYQl9Z.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

public/build/assets/appearance-6mdWloLa.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/build/assets/appearance-yUJUqOMY.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)