Skip to content

Commit

Permalink
Fix dark
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Oct 31, 2024
1 parent 96626ba commit e69d1dd
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 54 deletions.
6 changes: 5 additions & 1 deletion app/Services/Caches/Traits/Campaign/StyleCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ public function styles(): string
{
$key = $this->stylesKey();
if ($this->has($key)) {
return (string) $this->get($key);
//return (string) $this->get($key);
}

$css = "/**\n * Campaign Styles for campaign #" . $this->campaign->id . "\n */\n\n";
foreach ($this->campaign->styles()->enabled()->defaultOrder()->get() as $style) {
/** @var CampaignStyle $style */
if ($style->isTheme()) {
$css .= "/** Theme builder #" . $style->id . " */\n@layer theme {\n" . $style->content() . "\n}\n";
continue;
}
$css .= "/** Style " . $style->name . "#" . $style->id . " */\n" . $style->content() . "\n";
}

Expand Down
2 changes: 2 additions & 0 deletions resources/js/campaigns/theme-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const updateColour = (colour, target) => {

const change = (variable, value) => {
theme[variable] = value;
//theme['tb-' + variable] = value;
document.documentElement.style.setProperty('--' + variable, value);
//document.documentElement.style.setProperty('--tb-' + variable, value);
};

const contrast = (hsl, percentage = 0.8) => {
Expand Down
4 changes: 2 additions & 2 deletions resources/sass/campaign.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
}
.module-enabled {
.header {
background-color: hsl(var(--su)/1);
color: hsl(var(--suc)/1);
background-color: hsl(var(--p)/1);
color: hsl(var(--pc)/1);
}
.module-actions {
.btn-module-enable {
Expand Down
8 changes: 0 additions & 8 deletions resources/sass/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
* Everything related to the default footer
*/
footer {
img.logo-white {
display: var(--footer-logo-white, none);
}

img.logo-blue {
display: var(--footer-logo-blue, unset);
}

ul {
li {
a {
Expand Down
72 changes: 34 additions & 38 deletions resources/sass/themes/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
accent-color: hsl(var(--a)/1);
}
:root {
// Use the light kanka logo in the footer
--footer-logo-blue: none;
--footer-logo-white: inline;

// General background color
--base: 240 21% 15%;
--crust: 240 23% 9%;
Expand Down Expand Up @@ -35,9 +31,9 @@
--suc: var(--text);
--wac: var(--text);
--erc: var(--text);
--p: var(--subtext1);
--pc: var(--subtext0);
--pf: var(--subtext1);
--p: 287 84% 81%;
--pc: 287 78% 1%;
--pf: 287 88% 62%;
--s: 316 70% 50%;
--sc: var(--text);
--a: 175 70% 41%;
Expand All @@ -54,36 +50,36 @@
--sif: var(--surface1);
}

.btn2 {
--b2: var(--surface0);
--b3: var(--surface1);
}
.btn2.btn-primary {
--p: var(--surface0);
--pf: var(--surface1);
--pc: var(--text);
}
.btn-default {
--b2: var(--b3);
}
.quick-creator-subform {
--border-btn: 1px;
}
a {
--p: var(--mauve);
--pf: var(--pink);
}
dialog {
--b1: var(--b3);
}
input {
--p: var(--mauve);
--pc: var(--b3);
}
.achievements {
--p: var(--surface0);
--wac: var(--surface0);
}
//.btn2 {
// --b2: var(--surface0);
// --b3: var(--surface1);
//}
//.btn2.btn-primary {
// --p: var(--surface0);
// --pf: var(--surface1);
// --pc: var(--text);
//}
//.btn-default {
// --b2: var(--b3);
//}
//.quick-creator-subform {
// --border-btn: 1px;
//}
//a {
// --p: var(--mauve);
// --pf: var(--pink);
//}
//dialog {
// --b1: var(--b3);
//}
//input {
// --p: var(--mauve);
// --pc: var(--b3);
//}
//.achievements {
// --p: var(--surface0);
// --wac: var(--surface0);
//}
}
/*.btn2.btn-primary, .btn2.btn-accent, .btn2.btn-error, .btn2.btn-warning {
--tw-bg-opacity: 0;
Expand All @@ -92,7 +88,7 @@
}*/
.alert {
border: 1px solid var(--alert-bg);
--alert-bg: hsl(var(--b2)/1);
--alert-bg: hsl(var(--b1)/1);
}
/*.btn2.btn-outline {
border: none;
Expand Down
2 changes: 1 addition & 1 deletion resources/views/cruds/fields/name.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
data-type="{{ \Illuminate\Support\Str::singular($trans) }}" data-duplicate=".duplicate-warning" data-1p-ignore="true"
data-id="{{ $model->entity->id ?? null }}"
@if ($required) required="required" @endif
value="{!! htmlspecialchars(old('name', $model->name ?? '')) !!}" />
value="{!! str_replace('&', '&', htmlspecialchars(old('name', $model->name ?? ''))) !!}" />

<div class="text-warning-content duplicate-warning flex flex-col gap-1 hidden">
<span>{{ __('entities.creator.duplicate') }}</span>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/cruds/fields/title.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
field="title"
:label="__('characters.fields.title')">

<input type="text" name="title" value="{!! htmlspecialchars(old('title', $source->title ?? $model->title ?? '')) !!}"
<input type="text" name="title" value="{!! str_replace('&amp;', '&', htmlspecialchars(old('title', $source->title ?? $model->title ?? ''))) !!}"
placeholder="{{ __('characters.placeholders.title') }}" maxlength="191" spellcheck="true" />
</x-forms.field>
2 changes: 1 addition & 1 deletion resources/views/cruds/fields/type.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<x-forms.field
field="type"
label="{{ __('crud.fields.type') }}">
<input type="text" name="type" value="{!! htmlspecialchars(old('type', $source->type ?? $model->type ?? '')) !!}"
<input type="text" name="type" value="{!! str_replace('&amp;', '&', htmlspecialchars(old('type', $source->type ?? $model->type ?? ''))) !!}"
placeholder="{{ __($trans . '.placeholders.type') }}" maxlength="45" list="entity-type-list-{{ $trans }}"
spellcheck="true" autocomplete="off" />
<div class="hidden">
Expand Down
8 changes: 6 additions & 2 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,23 @@
@if (!empty($themeOverride) && in_array($themeOverride, ['dark', 'midnight', 'base']))
@php $specificTheme = $themeOverride; @endphp
@if($themeOverride != 'base')
@vite('resources/sass/themes/' . request()->get('_theme') . '.scss')

@vite('resources/sass/themes/' . $themeOverride . '.scss')
@endif
@else
@if (!empty($campaign) && $campaign->boosted() && !empty($campaign->theme_id))
@if ($campaign->theme_id !== 1)
@vite('resources/sass/themes/' . ($campaign->theme_id === 2 ? 'dark' : 'midnight') . '.scss')

@vite('resources/sass/themes/' . ($campaign->theme_id === 2 ? 'dark' : 'midnight') . '.scss')
@php $specificTheme = ($campaign->theme_id === 2 ? 'dark' : 'midnight') @endphp
@endif
@elseif (auth()->check() && !empty(auth()->user()->theme))

@vite('resources/sass/themes/' . auth()->user()->theme . '.scss')
@php $specificTheme = auth()->user()->theme @endphp
@endif
@endif

@includeWhen(!empty($campaign), 'layouts._theme')
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto&display=swap">
@livewireStyles
Expand Down

0 comments on commit e69d1dd

Please sign in to comment.