diff --git a/app/Filament/Admin/Pages/UserGuide.php b/app/Filament/Admin/Pages/UserGuide.php new file mode 100644 index 0000000..e2c461d --- /dev/null +++ b/app/Filament/Admin/Pages/UserGuide.php @@ -0,0 +1,65 @@ +getFirstGuide(); + + if ($firstGuide) { + $this->selectedGuide = $firstGuide['slug']; + } + } + + public static function getNavigationLabel(): string + { + return __('user-guide.navigation_label'); + } + + public function getTitle(): string + { + return __('user-guide.title'); + } + + public function getGuides(): array + { + $guideService = app(GuideService::class); + return $guideService->getAllGuides(); + } + + public function getSelectedGuideContent(): ?array + { + if (!$this->selectedGuide) { + return null; + } + + $guideService = app(GuideService::class); + return $guideService->getGuide($this->selectedGuide); + } + + public function selectGuide(string $slug): void + { + $guideService = app(GuideService::class); + + if ($guideService->guideExists($slug)) { + $this->selectedGuide = $slug; + } + } +} + diff --git a/app/Services/GuideService.php b/app/Services/GuideService.php new file mode 100644 index 0000000..19819d6 --- /dev/null +++ b/app/Services/GuideService.php @@ -0,0 +1,108 @@ +guidePath = resource_path('views/guide'); + } + + /** + * Tüm markdown dosyalarını son güncellenme tarihine göre sıralı olarak getir + * + * @return array + */ + public function getAllGuides(): array + { + if (!File::exists($this->guidePath)) { + return []; + } + + $files = File::glob($this->guidePath . '/*.md'); + + $guides = []; + + foreach ($files as $file) { + $filename = File::basename($file); + $name = Str::before($filename, '.md'); + $modifiedTime = File::lastModified($file); + + $guides[] = [ + 'filename' => $filename, + 'name' => $name, + 'slug' => Str::slug($name), + 'path' => $file, + 'modified_time' => $modifiedTime, + 'modified_date' => date('Y-m-d H:i:s', $modifiedTime), + ]; + } + + // Son güncellenenden ilk güncellenene göre sırala + usort($guides, function ($a, $b) { + return $b['modified_time'] <=> $a['modified_time']; + }); + + return $guides; + } + + /** + * Belirli bir guide dosyasını getir + * + * @param string $slug + * @return array|null + */ + public function getGuide(string $slug): ?array + { + $guides = $this->getAllGuides(); + + foreach ($guides as $guide) { + if ($guide['slug'] === $slug) { + $guide['content'] = File::get($guide['path']); + return $guide; + } + } + + return null; + } + + /** + * İlk guide'ı getir (varsayılan olarak gösterilecek) + * + * @return array|null + */ + public function getFirstGuide(): ?array + { + $guides = $this->getAllGuides(); + + if (empty($guides)) { + return null; + } + + $firstGuide = $guides[0]; + $firstGuide['content'] = File::get($firstGuide['path']); + + return $firstGuide; + } + + /** + * Guide dosyasının var olup olmadığını kontrol et + * + * @param string $slug + * @return bool + */ + public function guideExists(string $slug): bool + { + return $this->getGuide($slug) !== null; + } +} + diff --git a/lang/en/placeholder-picker.php b/lang/en/placeholder-picker.php index 4ceb7e7..b4ed6e5 100644 --- a/lang/en/placeholder-picker.php +++ b/lang/en/placeholder-picker.php @@ -4,6 +4,8 @@ return [ 'title' => 'Placeholder Variables', 'click_to_insert' => 'Click to insert into editor', 'special_placeholders' => 'Special Placeholders', + 'search_placeholder' => 'Search placeholders...', + 'no_results' => 'No results found', // Placeholder Types 'type_text' => 'Text', diff --git a/lang/en/user-guide.php b/lang/en/user-guide.php new file mode 100644 index 0000000..1427ab0 --- /dev/null +++ b/lang/en/user-guide.php @@ -0,0 +1,15 @@ + 'User Guide', + 'navigation_label' => 'User Guide', + + 'menu_title' => 'Guides', + 'search_placeholder' => 'Search guides...', + 'no_guides' => 'No guide files found yet.', + 'no_guide_selected' => 'No Guide Selected', + 'select_guide_from_menu' => 'Please select a guide from the left menu.', + 'last_updated' => 'Last updated', + 'no_results' => 'No results found.', +]; + diff --git a/lang/tr/placeholder-picker.php b/lang/tr/placeholder-picker.php index dd95440..29a2d86 100644 --- a/lang/tr/placeholder-picker.php +++ b/lang/tr/placeholder-picker.php @@ -4,6 +4,8 @@ return [ 'title' => 'Placeholder Değişkenleri', 'click_to_insert' => 'Tıklayarak editöre ekle', 'special_placeholders' => 'Özel Placeholder\'lar', + 'search_placeholder' => 'Placeholder ara...', + 'no_results' => 'Arama sonucu bulunamadı', // Placeholder Tipleri 'type_text' => 'Metin', diff --git a/lang/tr/user-guide.php b/lang/tr/user-guide.php new file mode 100644 index 0000000..027a86e --- /dev/null +++ b/lang/tr/user-guide.php @@ -0,0 +1,15 @@ + 'Kullanıcı Kılavuzu', + 'navigation_label' => 'Kullanıcı Kılavuzu', + + 'menu_title' => 'Kılavuzlar', + 'search_placeholder' => 'Kılavuz ara...', + 'no_guides' => 'Henüz kılavuz dosyası bulunmamaktadır.', + 'no_guide_selected' => 'Kılavuz Seçilmedi', + 'select_guide_from_menu' => 'Lütfen sol menüden bir kılavuz seçin.', + 'last_updated' => 'Son güncelleme', + 'no_results' => 'Arama sonucu bulunamadı.', +]; + diff --git a/resources/views/components/placeholder-picker.blade.php b/resources/views/components/placeholder-picker.blade.php index 3191dab..02230ba 100644 --- a/resources/views/components/placeholder-picker.blade.php +++ b/resources/views/components/placeholder-picker.blade.php @@ -30,246 +30,358 @@ $fieldName = $fieldName ?? 'html_content'; @endphp -
+ {menu}
+ {staticMenu}
+ {{ __('placeholder-picker.no_results') }}
+