Skip to content

Commit

Permalink
Merge pull request #2004 from amit-webkul/config
Browse files Browse the repository at this point in the history
feat: update brand color to use CSS variable.
  • Loading branch information
devansh-webkul authored Jan 29, 2025
2 parents cd53e6e + 7df5c35 commit 9790fbf
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 150 deletions.
54 changes: 8 additions & 46 deletions packages/Webkul/Admin/src/Config/core_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,11 @@
'sort' => 1,
'fields' => [
[
'name' => 'powered_by',
'name' => 'label',
'title' => 'admin::app.configuration.index.general.settings.footer.powered-by',
'type' => 'text',
'default' => 'Powered by',
'validation' => 'max:50',
], [
'name' => 'powered_by_redirection_title',
'title' => 'admin::app.configuration.index.general.settings.footer.powered-by-redirection-title',
'type' => 'text',
'default' => 'Krayin',
'validation' => 'max:20',
], [
'name' => 'powered_by_redirection_link',
'title' => 'admin::app.configuration.index.general.settings.footer.powered-by-redirection-link',
'default' => 'https://krayincrm.com',
'type' => 'text',
], [
'name' => 'other',
'title' => 'admin::app.configuration.index.general.settings.footer.other',
'type' => 'text',
'default' => 'an open-source project by',
'validation' => 'max:100',
], [
'name' => 'other_redirection_title',
'title' => 'admin::app.configuration.index.general.settings.footer.other-redirection-title',
'type' => 'text',
'default' => 'Webkul',
'validation' => 'max:25',
], [
'name' => 'other_redirection_link',
'title' => 'admin::app.configuration.index.general.settings.footer.other-redirection-link',
'default' => 'https://webkul.com',
'type' => 'text',
'type' => 'editor',
'default' => 'Powered by <span style="color: rgb(14, 144, 217);"><a href="http://www.krayincrm.com" target="_blank">Krayin</a></span>, an open-source project by <span style="color: rgb(14, 144, 217);"><a href="https://webkul.com" target="_blank">Webkul</a></span>.',
'tinymce' => true,
],
],
], [
Expand Down Expand Up @@ -198,20 +170,10 @@
'sort' => 2,
'fields' => [
[
'name' => 'active_background_color',
'title' => 'admin::app.configuration.index.general.settings.menu-color.active-background-color',
'type' => 'color',
'default' => '#0E90D9',
], [
'name' => 'active_text_color',
'title' => 'admin::app.configuration.index.general.settings.menu-color.active-text-color',
'type' => 'color',
'default' => '#ffffff',
], [
'name' => 'text_color',
'title' => 'admin::app.configuration.index.general.settings.menu-color.text-color',
'type' => 'color',
'default' => '#757575',
'name' => 'brand_color',
'title' => 'admin::app.configuration.index.general.settings.menu-color.brand-color',
'type' => 'color',
'default' => '#0E90D9',
],
],
],
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/ar/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1904,14 +1904,9 @@
'info' => 'قم بتحديث إعداداتك هنا.',

'footer' => [
'info' => 'يمكننا تكوين قسم "مشغل بواسطة" هنا.',
'other' => 'أخرى',
'other-redirection-link' => 'رابط إعادة التوجيه الآخر',
'other-redirection-title' => 'عنوان إعادة التوجيه الآخر',
'powered-by' => 'مشغل بواسطة',
'powered-by-redirection-link' => 'رابط إعادة التوجيه "مشغل بواسطة"',
'powered-by-redirection-title' => 'عنوان إعادة التوجيه "مشغل بواسطة"',
'title' => 'تكوينات قسم "مشغل بواسطة"',
'info' => 'يمكننا تكوين قسم "مشغل بواسطة" هنا.',
'powered-by' => 'مشغل بواسطة',
'title' => 'تكوينات قسم "مشغل بواسطة"',
],

'menu' => [
Expand Down
19 changes: 6 additions & 13 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1906,14 +1906,9 @@
'info' => 'Update your settings here.',

'footer' => [
'info' => 'We can configure the powered by section here.',
'other' => 'Other',
'other-redirection-link' => 'Other Redirection Link',
'other-redirection-title' => 'Other Redirection Title',
'powered-by' => 'Powered by',
'powered-by-redirection-link' => 'Powered by Redirection Link',
'powered-by-redirection-title' => 'Powered by Redirection Title',
'title' => 'Powered by Section Configurations',
'info' => 'We can configure the powered by section here.',
'powered-by' => 'Powered by text editor',
'title' => 'Powered by Section Configurations',
],

'menu' => [
Expand All @@ -1938,11 +1933,9 @@
],

'menu-color' => [
'active-background-color' => 'Active Background Color',
'active-text-color' => 'Active Text Color',
'info' => 'We can change the menu items colors here.',
'text-color' => 'Text Color',
'title' => 'Menu Item Color Configurations',
'brand-color' => 'Brand Color',
'info' => 'We can change the menu items colors here.',
'title' => 'Menu Item Color Configurations',
],
],
],
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1905,14 +1905,9 @@
'info' => 'Actualiza tus configuraciones aquí.',

'footer' => [
'info' => 'Podemos configurar la sección de powered by aquí.',
'other' => 'Otro',
'other-redirection-link' => 'Otro Enlace de Redirección',
'other-redirection-title' => 'Otro Título de Redirección',
'powered-by' => 'Desarrollado por',
'powered-by-redirection-link' => 'Enlace de Redirección de Powered by',
'powered-by-redirection-title' => 'Título de Redirección de Powered by',
'title' => 'Configuraciones de la Sección Powered by',
'info' => 'Podemos configurar la sección de powered by aquí.',
'powered-by' => 'Editor de texto impulsado por',
'title' => 'Configuraciones de la Sección Powered by',
],

'menu' => [
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1906,14 +1906,9 @@
'info' => 'تنظیمات خود را اینجا به‌روزرسانی کنید.',

'footer' => [
'info' => 'ما می‌توانیم بخش "توسعه یافته توسط" را اینجا پیکربندی کنیم.',
'other' => 'دیگر',
'other-redirection-link' => 'لینک هدایت دیگر',
'other-redirection-title' => 'عنوان هدایت دیگر',
'powered-by' => 'توسعه یافته توسط',
'powered-by-redirection-link' => 'لینک هدایت توسعه یافته توسط',
'powered-by-redirection-title' => 'عنوان هدایت توسعه یافته توسط',
'title' => 'پیکربندی بخش "توسعه یافته توسط"',
'info' => 'ما می‌توانیم بخش "توسعه یافته توسط" را اینجا پیکربندی کنیم.',
'powered-by' => 'توسعه یافته توسط ویرایشگر متن',
'title' => 'پیکربندی بخش "توسعه یافته توسط"',
],

'menu' => [
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1899,14 +1899,9 @@
'info' => 'Atualize suas configurações aqui.',

'footer' => [
'info' => 'Podemos configurar a seção powered by aqui.',
'other' => 'Outro',
'other-redirection-link' => 'Outro Link de Redirecionamento',
'other-redirection-title' => 'Outro Título de Redirecionamento',
'powered-by' => 'Powered by',
'powered-by-redirection-link' => 'Link de Redirecionamento Powered by',
'powered-by-redirection-title' => 'Título de Redirecionamento Powered by',
'title' => 'Configurações da Seção Powered by',
'info' => 'Podemos configurar a seção powered by aqui.',
'powered-by' => 'Editor de texto "Powered by"',
'title' => 'Configurações da Seção Powered by',
],

'menu' => [
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/tr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1906,14 +1906,9 @@
'info' => 'Ayarlarınızı burada güncelleyin.',

'footer' => [
'info' => 'Powered by bölümünü burada yapılandırabiliriz.',
'other' => 'Diğer',
'other-redirection-link' => 'Diğer Yönlendirme Bağlantısı',
'other-redirection-title' => 'Diğer Yönlendirme Başlığı',
'powered-by' => 'Tarafından desteklenmektedir',
'powered-by-redirection-link' => 'Powered by Yönlendirme Bağlantısı',
'powered-by-redirection-title' => 'Powered by Yönlendirme Başlığı',
'title' => 'Powered by Bölüm Yapılandırmaları',
'info' => 'Powered by bölümünü burada yapılandırabiliriz.',
'powered-by' => 'Powered by metin düzenleyici',
'title' => 'Powered by Bölüm Yapılandırmaları',
],

'menu' => [
Expand Down
11 changes: 3 additions & 8 deletions packages/Webkul/Admin/src/Resources/lang/vi/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -1905,14 +1905,9 @@
'info' => 'Cập nhật cài đặt của bạn tại đây.',

'footer' => [
'info' => 'Chúng tôi có thể cấu hình phần powered by tại đây.',
'other' => 'Khác',
'other-redirection-link' => 'Liên kết Chuyển hướng Khác',
'other-redirection-title' => 'Tiêu đề Chuyển hướng Khác',
'powered-by' => 'Được hỗ trợ bởi',
'powered-by-redirection-link' => 'Liên kết Chuyển hướng Powered by',
'powered-by-redirection-title' => 'Tiêu đề Chuyển hướng Powered by',
'title' => 'Cấu hình Phần Powered by',
'info' => 'Chúng tôi có thể cấu hình phần powered by tại đây.',
'powered-by' => 'Được hỗ trợ bởi trình chỉnh sửa văn bản',
'title' => 'Cấu hình Phần Powered by',
],

'menu' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ class="flex w-full items-center overflow-hidden rounded-md border text-sm text-g
type="{{ $type }}"
name="{{ $name }}"
v-bind="field"
id="{{ $attributes->get(':id', $attributes->get('id')) }}"
:class="[errors.length ? 'border !border-red-600 hover:border-red-600' : '']"
{{ $attributes->except(['value', ':value', 'v-model', 'rules', ':rules', 'label', ':label'])->merge(['class' => 'w-full rounded border border-gray-200 px-2.5 py-2 text-sm font-normal text-gray-800 transition-all hover:border-gray-400 focus:border-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:hover:border-gray-400 dark:focus:border-gray-400']) }}
>
</textarea>

@if ($attributes->get('tinymce', false) || $attributes->get(':tinymce', false))
<x-admin::tinymce
:selector="'textarea#' . $attributes->get('id')"
:selector="'textarea#' . $attributes->get(':id', 'id')"
::field="field"
/>
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ class="{{ request()->cookie('dark_mode') ? 'dark' : '' }}"
/>
@endif

@php
$brandColor = core()->getConfigData('general.settings.menu_color.brand_color') ?? '#0E90D9';
@endphp

@stack('styles')

<style>
:root {
--brand-color: {{ $brandColor }};
}
{!! core()->getConfigData('general.content.custom_scripts.custom_css') !!}
</style>

Expand Down Expand Up @@ -117,25 +125,7 @@ class="group/container sidebar-collapsed flex gap-4"
<!-- Powered By -->
<div class="mt-auto pt-6">
<div class="border-t bg-white py-5 text-center text-sm font-normal dark:border-gray-800 dark:bg-gray-900 dark:text-white">
<p>
{{ core()->getConfigData('general.settings.footer.powered_by') }}

<a
class="text-brandColor hover:underline dark:text-brandColor"
href="{{ core()->getConfigData('general.settings.footer.powered_by_redirection_link') }}"
>
{{ core()->getConfigData('general.settings.footer.powered_by_redirection_title') }}
</a>,

{{ core()->getConfigData('general.settings.footer.other') }}

<a
class="text-brandColor hover:underline dark:text-brandColor"
href="{{ core()->getConfigData('general.settings.footer.other_redirection_link') }}"
>
{{ core()->getConfigData('general.settings.footer.other_redirection_title') }}
</a>
</p>
<p>{!! core()->getConfigData('general.settings.footer.label') !!}</p>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,15 @@ class="duration-80 fixed top-[60px] z-[10002] h-full w-[200px] border-gray-200 b
@foreach (menu()->getItems('admin') as $menuItem)
<div class="px-4 group/item {{ $menuItem->isActive() ? 'active' : 'inactive' }}">
<a
class="flex gap-2 p-1.5 items-center cursor-pointer hover:rounded-lg {{ $menuItem->isActive() == 'active' ? 'rounded-lg' : ' hover:bg-gray-100 hover:dark:bg-gray-950' }} peer"
style="background-color: {{ $menuItem->isActive() == 'active' ? (core()->getConfigData('general.settings.menu_color.active_background_color') ?? '#0E90D9') : '' }}"
class="flex gap-2 p-1.5 items-center cursor-pointer hover:rounded-lg {{ $menuItem->isActive() == 'active' ? 'bg-brandColor rounded-lg' : ' hover:bg-gray-100 hover:dark:bg-gray-950' }} peer"
href="{{ ! in_array($menuItem->getKey(), ['settings', 'configuration']) && $menuItem->haveChildren() ? 'javascript:void(0)' : $menuItem->getUrl() }}"
@mouseleave="!isMenuActive ? hoveringMenu = '' : {}"
@mouseover="hoveringMenu='{{$menuItem->getKey()}}'"
@click="isMenuActive = !isMenuActive"
>
<span
class="{{ $menuItem->getIcon() }} text-2xl"
style="color: {{ $menuItem->isActive() ? (core()->getConfigData('general.settings.menu_color.active_text_color') ?? '#ffffff') : (core()->getConfigData('general.settings.menu_color.text_color') ?? '#757575') }}"
></span>
<span class="{{ $menuItem->getIcon() }} text-2xl {{ $menuItem->isActive() ? 'text-white' : ''}}"></span>

<div
class="group flex flex-1 items-center justify-between whitespace-nowrap font-medium text-gray-600 group-[.sidebar-collapsed]/container:hidden dark:text-gray-300"
style="color: {{ $menuItem->isActive() ? (core()->getConfigData('general.settings.menu_color.active_text_color') ?? '#ffffff') : (core()->getConfigData('general.settings.menu_color.text_color') ?? '#757575') }}"
>
<div class="flex-1 flex justify-between items-center text-gray-600 dark:text-gray-300 font-medium whitespace-nowrap group-[.sidebar-collapsed]/container:hidden {{ $menuItem->isActive() ? 'text-white' : ''}} group">
<p>{{ core()->getConfigData('general.settings.menu.'.$menuItem->getKey()) ?? $menuItem->getName() }}</p>

@if ( ! in_array($menuItem->getKey(), ['settings', 'configuration']) && $menuItem->haveChildren())
Expand All @@ -52,10 +45,7 @@ class="absolute top-0 hidden flex-col bg-gray-100 ltr:left-[200px] rtl:right-[19
href="{{ $subMenuItem->getUrl() }}"
class="flex gap-2.5 p-2 items-center cursor-pointer hover:rounded-lg {{ $subMenuItem->isActive() == 'active' ? 'bg-brandColor rounded-lg' : ' hover:bg-gray-100 hover:dark:bg-gray-950' }} peer"
>
<p
class="dark:text-gray-300 font-medium whitespace-nowrap {{ $subMenuItem->isActive() ? 'text-white' : ''}}"
style="color: {{ core()->getConfigData('general.settings.menu_color.text_color') ?? '#757575' }}"
>
<p class="text-gray-600 dark:text-gray-300 font-medium whitespace-nowrap {{ $subMenuItem->isActive() ? 'text-white' : ''}}">
{{ core()->getConfigData('general.settings.menu.'.$subMenuItem->getKey()) ?? $subMenuItem->getName() }}
</p>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
},
mounted() {
tinymce.remove(this.selector);
this.init();
this.$emitter.on('change-theme', (theme) => {
Expand Down
Loading

0 comments on commit 9790fbf

Please sign in to comment.