-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from tomatophp/develop
update social links crud
- Loading branch information
Showing
11 changed files
with
244 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Modules\CircleXO\App\View\Components; | ||
|
||
use Illuminate\View\Component; | ||
use Illuminate\View\View; | ||
|
||
class SocialItem extends Component | ||
{ | ||
/** | ||
* Create a new component instance. | ||
*/ | ||
public function __construct( | ||
public string $network, | ||
public string $label, | ||
) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the view/contents that represent the component. | ||
*/ | ||
public function render(): View|string | ||
{ | ||
return view('circle-xo::components.social-item'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Modules\CircleXO\App\View\Components; | ||
|
||
use App\Models\Account; | ||
use Illuminate\View\Component; | ||
use Illuminate\View\View; | ||
|
||
class SocialLinks extends Component | ||
{ | ||
/** | ||
* Create a new component instance. | ||
*/ | ||
public function __construct( | ||
public Account $account, | ||
public bool $edit = false, | ||
) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the view/contents that represent the component. | ||
*/ | ||
public function render(): View|string | ||
{ | ||
return view('circle-xo::components.social-links'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Modules/CircleXO/resources/views/components/social-item.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<button @click.prevent="form.name = '{{ $network }}'" :class="{'bg-main-600 text-zinc-600': form.name === '{{ $network }}', 'bg-zinc-900 text-white': form.name !== '{{ $network }}'}" class="flex justify-center text-center border-zinc-700 p-4 rounded-lg border shadow-sm"> | ||
<div class="flex flex-col justify-center gap-2"> | ||
<i class="bx bxl-{{ $network }} text-3xl"></i> | ||
<h1 class="font-bold">{{$label}}</h1> | ||
</div> | ||
</button> |
25 changes: 25 additions & 0 deletions
25
Modules/CircleXO/resources/views/components/social-links.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@if($account->meta('social')) | ||
@foreach($account->meta('social') as $social) | ||
@if($edit) | ||
<x-splade-link modal :href="route('profile.social.edit', $social['name'])" target="_blank"> | ||
<x-tomato-admin-tooltip :text="isset($social['label']) ? $social['label'] : $social['name'] "> | ||
@if($social['name'] !== 'website') | ||
<i class="bx bxl-{{ $social['name'] }} text-2xl text-zinc-200 hover:text-white"></i> | ||
@else | ||
<i class="bx bx-link text-2xl text-zinc-200 hover:text-white"></i> | ||
@endif | ||
</x-tomato-admin-tooltip> | ||
</x-splade-link> | ||
@else | ||
<a href="{{ $social['link'] }}" target="_blank"> | ||
<x-tomato-admin-tooltip :text="isset($social['label']) ? $social['label'] : $social['name'] "> | ||
@if($social['name'] !== 'website') | ||
<i class="bx bxl-{{ $social['name'] }} text-2xl text-zinc-200 hover:text-white"></i> | ||
@else | ||
<i class="bx bx-link text-2xl text-zinc-200 hover:text-white"></i> | ||
@endif | ||
</x-tomato-admin-tooltip> | ||
</a> | ||
@endif | ||
@endforeach | ||
@endif |
44 changes: 44 additions & 0 deletions
44
Modules/CircleXO/resources/views/profile/edit/social-edit.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<x-splade-modal> | ||
<x-slot:title> | ||
{{ __('Update Social Network') }} | ||
</x-slot> | ||
<x-splade-form :default="$network" class="flex flex-col gap-4" method="POST" action="{{route('profile.social.update', $network['name'])}}"> | ||
<div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4"> | ||
<x-circle-xo-social-item network="facebook" :label="__('Facebook')" /> | ||
<x-circle-xo-social-item network="twitter" :label="__('Twitter')" /> | ||
<x-circle-xo-social-item network="instagram" :label="__('Instagram')" /> | ||
<x-circle-xo-social-item network="tiktok" :label="__('Tiktok')" /> | ||
<x-circle-xo-social-item network="youtube" :label="__('Youtube')" /> | ||
<x-circle-xo-social-item network="behance" :label="__('Behance')" /> | ||
<x-circle-xo-social-item network="medium" :label="__('Medium')" /> | ||
<x-circle-xo-social-item network="reddit" :label="__('Reddit')" /> | ||
<x-circle-xo-social-item network="pinterest" :label="__('Pinterest')" /> | ||
<x-circle-xo-social-item network="snapchat" :label="__('Snapchat')" /> | ||
<x-circle-xo-social-item network="blogger" :label="__('Blogger')" /> | ||
<x-circle-xo-social-item network="patreon" :label="__('Patreon')" /> | ||
<x-circle-xo-social-item network="quora" :label="__('Quora')" /> | ||
<x-circle-xo-social-item network="dribbble" :label="__('Dribbble')" /> | ||
<x-circle-xo-social-item network="github" :label="__('GitHub')" /> | ||
<x-circle-xo-social-item network="linkedin" :label="__('LinkedIn')" /> | ||
<x-circle-xo-social-item network="twitch" :label="__('Twitch')" /> | ||
<x-circle-xo-social-item network="discord" :label="__('Discord')" /> | ||
<x-circle-xo-social-item network="figma" :label="__('Figma')" /> | ||
<x-circle-xo-social-item network="whatsapp" :label="__('Whatsapp')" /> | ||
<button @click.prevent="form.name = 'website'" :class="{'bg-main-600 text-zinc-600': form.name === 'website', 'bg-zinc-900 text-white': form.name !== 'website'}" class="flex justify-center text-center border-zinc-700 p-4 rounded-lg border shadow-sm"> | ||
<div class="flex flex-col justify-center gap-2"> | ||
<i class="bx bx-link text-3xl"></i> | ||
<h1 class="font-bold">{{__('Link')}}</h1> | ||
</div> | ||
</button> | ||
|
||
</div> | ||
|
||
<x-splade-input type="text" name="label" :label="__('Label')" /> | ||
<x-splade-input type="text" name="link" :label="__('Link')" /> | ||
|
||
<div class="flex justify-start gap-4"> | ||
<x-splade-submit spinner :label="__('Save')" class="bg-main-600 border-main-400 text-zinc-900" /> | ||
<x-tomato-admin-button method="DELETE" confirm-danger danger href="{{ route('profile.social.destroy', $network['name']) }}" :label="__('Remove')" /> | ||
</div> | ||
</x-splade-form> | ||
</x-splade-modal> |
56 changes: 35 additions & 21 deletions
56
Modules/CircleXO/resources/views/profile/edit/social.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,41 @@ | ||
<x-splade-modal> | ||
<x-slot:title> | ||
{{ __('Update Info') }} | ||
{{ __('Select Social Network') }} | ||
</x-slot> | ||
<x-splade-form :default="[ | ||
'social' => auth('accounts')->user()->meta('social') ?: [], | ||
]" class="flex flex-col gap-4" method="POST" action="{{route('profile.meta.update')}}"> | ||
<x-tomato-admin-repeater name="social" label="Links" :options="['name', 'link', 'label']"> | ||
<div class="flex flex-col gap-4"> | ||
<x-splade-select choices type="text" v-model="repeater.main[key].name" label="Name"> | ||
<option value="facebook">{{ __('Facebook') }}</option> | ||
<option value="twitter">{{ __('Twitter') }}</option> | ||
<option value="youtube">{{ __('Youtube') }}</option> | ||
<option value="instagram">{{ __('Instagram') }}</option> | ||
<option value="tiktok">{{ __('Tiktok') }}</option> | ||
<option value="github">{{ __('GitHub') }}</option> | ||
<option value="behance">{{ __('Behance') }}</option> | ||
<option value="website">{{ __('Website') }}</option> | ||
</x-splade-select> | ||
<x-splade-input type="text" v-model="repeater.main[key].label" label="Label" /> | ||
<x-splade-input type="text" v-model="repeater.main[key].link" label="Link" /> | ||
</div> | ||
</x-tomato-admin-repeater> | ||
<x-splade-form class="flex flex-col gap-4" method="POST" action="{{route('profile.social.store')}}"> | ||
<div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4"> | ||
<x-circle-xo-social-item network="facebook" :label="__('Facebook')" /> | ||
<x-circle-xo-social-item network="twitter" :label="__('Twitter')" /> | ||
<x-circle-xo-social-item network="instagram" :label="__('Instagram')" /> | ||
<x-circle-xo-social-item network="tiktok" :label="__('Tiktok')" /> | ||
<x-circle-xo-social-item network="youtube" :label="__('Youtube')" /> | ||
<x-circle-xo-social-item network="behance" :label="__('Behance')" /> | ||
<x-circle-xo-social-item network="medium" :label="__('Medium')" /> | ||
<x-circle-xo-social-item network="reddit" :label="__('Reddit')" /> | ||
<x-circle-xo-social-item network="pinterest" :label="__('Pinterest')" /> | ||
<x-circle-xo-social-item network="snapchat" :label="__('Snapchat')" /> | ||
<x-circle-xo-social-item network="blogger" :label="__('Blogger')" /> | ||
<x-circle-xo-social-item network="patreon" :label="__('Patreon')" /> | ||
<x-circle-xo-social-item network="quora" :label="__('Quora')" /> | ||
<x-circle-xo-social-item network="dribbble" :label="__('Dribbble')" /> | ||
<x-circle-xo-social-item network="github" :label="__('GitHub')" /> | ||
<x-circle-xo-social-item network="linkedin" :label="__('LinkedIn')" /> | ||
<x-circle-xo-social-item network="twitch" :label="__('Twitch')" /> | ||
<x-circle-xo-social-item network="discord" :label="__('Discord')" /> | ||
<x-circle-xo-social-item network="figma" :label="__('Figma')" /> | ||
<x-circle-xo-social-item network="whatsapp" :label="__('Whatsapp')" /> | ||
<button @click.prevent="form.name = 'website'" :class="{'bg-main-600 text-zinc-600': form.name === 'website', 'bg-zinc-900 text-white': form.name !== 'website'}" class="flex justify-center text-center border-zinc-700 p-4 rounded-lg border shadow-sm"> | ||
<div class="flex flex-col justify-center gap-2"> | ||
<i class="bx bx-link text-3xl"></i> | ||
<h1 class="font-bold">{{__('Link')}}</h1> | ||
</div> | ||
</button> | ||
|
||
<x-splade-button label="Update" class="bg-main-600 border-main-400 text-zinc-900" /> | ||
</div> | ||
|
||
<x-splade-input type="text" name="label" :label="__('Label')" /> | ||
<x-splade-input type="text" name="link" :label="__('Link')" /> | ||
|
||
<x-splade-submit spinner :label="__('Save')" class="bg-main-600 border-main-400 text-zinc-900" /> | ||
</x-splade-form> | ||
</x-splade-modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters