refactor: remove global RateCardProfile singleton usage from controllers and delete unused welcome view

This commit is contained in:
I-Fun
2026-04-06 09:33:43 +07:00
parent a72eec3ead
commit 737ba24293
9 changed files with 155 additions and 268 deletions

View File

@@ -315,23 +315,23 @@
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
@endphp
@if($file || $isUrl)
<div style="display:inline-block; width:180px; margin:10px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; overflow:hidden; vertical-align:top; background:#ffffff;">
<div style="height:120px; background:#F9FAFB; border-bottom:1px solid rgba(0,0,0,0.05); position:relative; text-align:center;">
<div style="display:inline-block; width:135px; margin:10px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; overflow:hidden; vertical-align:top; background:#ffffff;">
<div style="height:240px; background:#F9FAFB; border-bottom:1px solid rgba(0,0,0,0.05); position:relative; text-align:center;">
@if(!empty($item['thumbnail_path']) && file_exists(storage_path('app/public/' . $item['thumbnail_path'])))
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; position:relative;">
<img src="{{ storage_path('app/public/' . $item['thumbnail_path']) }}" style="width:100%; height:120px; object-fit:cover;">
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/public/' . $item['thumbnail_path']) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
@if(!$isUrl && $file->is_video)
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
<div style="width:30px; height:30px; background:rgba(255,255,255,0.8); border-radius:50%; display:flex; align-items:center; justify-content:center; color:{{ $accentHex }}; font-size:16px;">▶</div>
<div style="width:30px; height:30px; background:rgba(255,255,255,0.8); border-radius:50%; text-align:center; line-height:30px; color:{{ $accentHex }}; font-size:16px;">▶</div>
</div>
@endif
</a>
@elseif(!$isUrl && $file->is_image && file_exists(storage_path('app/private/' . $file->path)))
<a href="{{ $file->url }}" target="_blank" style="display:block; text-decoration:none;">
<img src="{{ storage_path('app/private/' . $file->path) }}" style="width:100%; height:120px; object-fit:cover;">
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/private/' . $file->path) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
</a>
@else
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; color:{{ $accentHex }}; padding-top:40px; font-weight:bold;">
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; color:{{ $accentHex }}; padding-top:90px; font-weight:bold;">
<span style="font-size:30px; display:block;">{{ $isUrl ? '🌐' : ($file->is_video ? '🎬' : '📁') }}</span>
{{ $isUrl ? 'Open Link' : 'View File' }}
</a>

View File

@@ -111,6 +111,63 @@
gap: 14px;
}
.carousel-wrapper {
position: relative;
}
.carousel-track {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
gap: 14px;
padding-bottom: 10px;
scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar {
display: none;
}
.carousel-slide {
flex: 0 0 220px;
scroll-snap-align: start;
}
.carousel-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 40px;
height: 40px;
border-radius: 50%;
background: white;
border: 1px solid rgba(0,0,0,0.05);
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
color:
{{ $profile->accent_color }}
;
font-size: 20px;
font-weight: 900;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
}
.carousel-btn:hover {
background: #fdfdfd;
box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}
.carousel-btn.prev {
left: -20px;
}
.carousel-btn.next {
right: -20px;
}
.card {
background: white;
border-radius: 24px;
@@ -123,6 +180,17 @@
22;
}
.popup-modal {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.service {
font-weight: 700;
color: #1F2937;
@@ -337,22 +405,32 @@
@if(!empty($publicShowcase))
<div class="platform-section" style="margin-top:40px;">
<div class="platform-title" style="justify-content:center;">Content Showcase</div>
<div class="cards">
@php $isCarousel = count($publicShowcase) >= 3; @endphp
@if($isCarousel)
<div class="carousel-wrapper" x-data="{
scrollPrev() { $refs.slider.scrollBy({left: -234, behavior: 'smooth'}); },
scrollNext() { $refs.slider.scrollBy({left: 234, behavior: 'smooth'}); }
}">
<button type="button" class="carousel-btn prev" @click="scrollPrev()">&#10094;</button>
<div class="carousel-track" x-ref="slider">
@else
<div class="cards">
@endif
@foreach($publicShowcase as $item)
@php
$isUrl = ($item['file_id'] === 'url');
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
@endphp
@if($file || $isUrl)
<div class="card" style="padding:0; overflow:hidden; display:flex; flex-direction:column;">
<div class="card {{ $isCarousel ? 'carousel-slide' : '' }}" style="padding:0; overflow:hidden; display:flex; flex-direction:column;">
<div style="flex:1; background:#F9FAFB; display:flex; align-items:center; justify-content:center; position:relative;">
@if(!empty($item['thumbnail_path']))
@if(!$isUrl && $file->is_image)
<div style="width:100%; height:180px; cursor:pointer; position:relative;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<div style="width:100%; aspect-ratio:9/16; cursor:pointer; position:relative;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
</div>
@else
<a href="{{ $isUrl ? ($item['url'] ?? '#') : $file->url }}" target="_blank" style="display:block; width:100%; height:180px; position:relative;">
<a href="{{ $isUrl ? ($item['url'] ?? '#') : $file->url }}" target="_blank" style="display:block; width:100%; aspect-ratio:9/16; position:relative;">
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
@if(!$isUrl && $file->is_video)
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
@@ -362,19 +440,19 @@
</a>
@endif
@elseif($isUrl)
<div style="height:180px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<span style="font-size:48px;">🌐</span>
<a href="{{ $item['url'] ?? '#' }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">Open Link</a>
</div>
@else
@if($file->is_image)
<div style="width:100%; height:180px; cursor:pointer;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<div style="width:100%; aspect-ratio:9/16; cursor:pointer;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<img src="{{ $file->url }}" style="width:100%; height:100%; object-fit:cover; display:block;">
</div>
@elseif($file->is_video)
<video src="{{ $file->url }}" style="width:100%; height:180px; object-fit:cover; display:block;" controls></video>
<video src="{{ $file->url }}" style="width:100%; aspect-ratio:9/16; object-fit:cover; display:block;" controls></video>
@else
<div style="height:180px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<span style="font-size:48px;">{{ $file->icon }}</span>
<a href="{{ $file->url }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">View File</a>
</div>
@@ -387,7 +465,13 @@
</div>
@endif
@endforeach
</div>
@if($isCarousel)
</div>
<button type="button" class="carousel-btn next" @click="scrollNext()">&#10095;</button>
</div>
@else
</div>
@endif
</div>
@endif
@@ -406,7 +490,7 @@
</div>
<!-- Image Popup Modal -->
<div x-show="popupOpen" x-transition.opacity style="display:none; position:fixed; inset:0; background:rgba(0,0,0,0.8); z-index:9999; align-items:center; justify-content:center; padding:20px;" :style="popupOpen ? 'display:flex' : 'display:none'">
<div x-show="popupOpen" x-transition.opacity style="display:none;" class="popup-modal">
<div style="position:absolute; inset:0; cursor:pointer;" @click="popupOpen = false"></div>
<img :src="popupImage" style="max-width:100%; max-height:100%; object-fit:contain; position:relative; z-index:10000; border-radius:12px; box-shadow:0 10px 25px rgba(0,0,0,0.5);">
<button @click="popupOpen = false" style="position:absolute; top:20px; right:20px; background:rgba(255,255,255,0.2); border:none; color:white; font-size:30px; width:40px; height:40px; border-radius:50%; cursor:pointer; z-index:10001; display:flex; align-items:center; justify-content:center;">&times;</button>

File diff suppressed because one or more lines are too long