Skip to content

Commit

Permalink
update chat to be 20 per page
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Apr 5, 2024
1 parent aa0f09a commit fe88c9a
Show file tree
Hide file tree
Showing 9 changed files with 2,237 additions and 253 deletions.
8 changes: 7 additions & 1 deletion Modules/CircleXO/App/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function messages(Request $request)
$query->where('name', 'LIKE', '%'.$request->get('search').'%');
});
}
$chats = $messages->paginate(2);
$chats = $messages->paginate(20);

$getSelectedChat = null;
if($request->has('chat') && $request->get('chat')){
Expand Down Expand Up @@ -215,6 +215,7 @@ public function updateInfo(Request $request)
$request->validate([
"name" => "required|string|max:255",
"bio" => "nullable|string|max:255",
"lang" => "nullable|string|max:255",
"username" => "required|string|max:255|unique:accounts,username,".auth('accounts')->id(),
"email" => "required|string|email|max:255|unique:accounts,email,".auth('accounts')->id(),
]);
Expand All @@ -223,6 +224,11 @@ public function updateInfo(Request $request)

$account->update($request->all());


if($request->has('lang') && !empty($request->get('lang'))){
$account->meta('lang', $request->get('lang'));
}

if($request->has('bio') && !empty($request->get('bio'))){
$account->meta('bio', $request->get('bio'));
}
Expand Down
23 changes: 23 additions & 0 deletions Modules/CircleXO/App/Http/Middleware/LangMiddleware.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Modules\CircleXO\App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class LangMiddleware
{
/**
* Handle an incoming request.
*/
public function handle(Request $request, Closure $next)
{
if(auth('accounts')->user()){
if(auth('accounts')->user()->meta('lang')){
app()->setLocale(auth('accounts')->user()->meta('lang'));
}
}

return $next($request);
}
}
2 changes: 2 additions & 0 deletions Modules/CircleXO/App/Providers/CircleXOServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function register(): void
$this->app->bind('circle-xo-slots', function () {
return new \Modules\CircleXO\App\Services\CircleSlotServices();
});

$this->app['router']->pushMiddlewareToGroup('web', \Modules\CircleXO\App\Http\Middleware\LangMiddleware::class);
}

public function registerComponents(): void
Expand Down
9 changes: 9 additions & 0 deletions Modules/CircleXO/resources/views/components/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ class="text-white transition hover:text-zinc-300"
@endif
</nav>
</footer>

<x-splade-script>
let htmlEl = document.querySelector("html");
if ("{{app()->getLocale()}}" === "ar") {
htmlEl.setAttribute("dir", "rtl");
} else {
htmlEl.setAttribute("dir", "ltr");
}
</x-splade-script>
18 changes: 13 additions & 5 deletions Modules/CircleXO/resources/views/profile/edit/info.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
@section('content')
<x-splade-form :default="[
'name' => auth('accounts')->user()->name,
// 'lang' => auth('accounts')->user()->meta('lang') ?? app()->getLocale(),
'email' => auth('accounts')->user()->email,
'bio' => auth('accounts')->user()->meta('bio'),
'address' => auth('accounts')->user()->address,
'username' => str(auth('accounts')->user()->username)->replaceFirst('@', ''),
]" class="flex flex-col gap-4" method="POST" action="{{route('profile.info.update')}}">
<x-splade-input name="name" label="Name" />
<x-splade-input name="email" type="email" label="email" />
<x-splade-input name="address" label="location" />
<x-splade-input name="username" label="username" />
<x-splade-textarea autosize name="bio" label="Bio" />
<x-splade-input name="name" :label="__('Name')" />
<x-splade-input name="email" type="email" :label="__('Email')" />
<x-splade-input name="address" :label="__('Location')" />
<x-splade-input name="username" :label="__('Username')" />
{{-- <x-splade-select choices name="lang" :label="__('Language')" >--}}
{{-- @foreach(config('tomato-admin.langs') as $locale)--}}
{{-- <option value="{{$locale['key']}}" @if(auth('accounts')->user()->meta('lang') == $locale['key']) selected @endif>--}}
{{-- {{$locale['label'][app()->getLocale()]}}--}}
{{-- </option>--}}
{{-- @endforeach--}}
{{-- </x-splade-select>--}}
<x-splade-textarea autosize name="bio" :label="__('Bio')" />

<x-splade-submit spinner label="Update" class="bg-main-600 border-main-400 text-zinc-900" />
</x-splade-form>
Expand Down
16 changes: 9 additions & 7 deletions Modules/CircleXO/resources/views/sections/hero.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
@php
$accounts = \App\Models\Account::inRandomOrder()->take($section['profile_count'] ?? 4)->get();
@endphp
<CardsSlider>
@foreach ($accounts as $account)
<swiper-slide>
<x-circle-xo-profile-card :account="$account" />
</swiper-slide>
@endforeach
</CardsSlider>
<div style="direction: ltr !important;">
<CardsSlider>
@foreach ($accounts as $account)
<swiper-slide>
<x-circle-xo-profile-card :account="$account" />
</swiper-slide>
@endforeach
</CardsSlider>
</div>
</div>
</div>
</section>
76 changes: 76 additions & 0 deletions config/tomato-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

use TomatoPHP\TomatoMenus\Services\MenuRenderBase;

return [
/**
* you can add a new Menus Class that generated by tomato:menu MENU_NAME here to register
* the menu to the tomato-admin menu system
*/
"menus" => [
//
],

/**
* you can provide your own menu class to render the menu
* the class must return a full rendered menu.
*/
"menu_provider" => null,

/**
* if you need to change the main menu with your own menu file
*/
"menu_file" => null,

/**
* if you need to change the route prefix
*/
"route_perfix" => "admin",

/**
* if you need to disable the register route
*/
"register" => true,

/**
* if you need to change the route middlewares
*/
"route_middlewares" => [
"web"
],

/**
* if you need to change the route path for global search
*/
"global_search_route" => null,

"langs" => [
[
"key" => "ar",
"label" => [
"ar" => "العربية",
"en" => "Arabic",
"gr" => "Arabische",
],
"flag" => "🇪🇬"
],
[
"key" => "en",
"label" => [
"ar" => "الانجليزية",
"en" => "English",
"gr" => "Englische",
],
"flag" => "🇺🇸"
],
[
"key" => "gr",
"label" => [
"ar" => "الالمانية",
"en" => "Germany",
"gr" => "Deutsche",
],
"flag" => "🇩🇪"
]
]
];

0 comments on commit fe88c9a

Please sign in to comment.