updated template

This commit is contained in:
berkay 2025-04-17 16:22:49 +03:00
parent da95b629ac
commit 71822681f2
4 changed files with 89 additions and 48 deletions

View File

@ -2,34 +2,30 @@
import React from "react";
import Template from "@/components/Pages/template/app";
import ClientMenu from "@/components/menuCleint/menu";
import { LanguageKey } from "@/components/Pages/template/language";
import {
getTranslation,
LanguageKey,
} from "@/components/Pages/template/language";
import { retrievePageList } from "@/apicalls/cookies/token";
interface TemplatePageProps {
params: { lang?: string };
searchParams: { [key: string]: string | string[] | undefined };
}
async function TemplatePage({ params, searchParams }: TemplatePageProps) {
async function TemplatePage({ searchParams }: TemplatePageProps) {
// Get language from query params or default to 'en'
const pParams = await params;
const siteUrlsList = (await retrievePageList()) || [];
const searchParamsInstance = await searchParams;
const activePage = "/template";
const lang = (searchParamsInstance?.lang as LanguageKey) || "en";
const t = getTranslation(lang);
return (
<>
<>
<div className="min-h-screen min-w-screen flex w-full">
{/* Sidebar */}
<aside className="w-1/4 border-r p-4 overflow-y-auto h-screen sticky top-0">
<div className="w-full">
<ClientMenu
siteUrls={siteUrlsList}
lang={lang}
/>
<ClientMenu siteUrls={siteUrlsList} lang={lang} />
</div>
</aside>
@ -37,11 +33,11 @@ async function TemplatePage({ params, searchParams }: TemplatePageProps) {
<div className="flex flex-col w-3/4 overflow-y-auto">
{/* Sticky Header */}
<header className="sticky top-0 bg-white shadow-md z-10 p-4 flex justify-between items-center">
<h1 className="text-2xl font-semibold">{activePage}</h1>
<h1 className="text-2xl font-semibold">{t.title}</h1>
<div className="flex items-center space-x-4">
<input
type="text"
placeholder="Search..."
placeholder={t.search}
className="border px-3 py-2 rounded-lg"
/>
<div className="w-10 h-10 bg-gray-300 rounded-full"></div>
@ -53,7 +49,6 @@ async function TemplatePage({ params, searchParams }: TemplatePageProps) {
</div>
</div>
</>
</>
);
}

View File

@ -1,5 +1,5 @@
import React from 'react';
import { getTranslation, LanguageKey } from './language';
import React from "react";
import { getTranslation, LanguageKey } from "./language";
interface ActionButtonsComponentProps {
onCreateClick: () => void;
@ -8,19 +8,23 @@ interface ActionButtonsComponentProps {
export function ActionButtonsComponent({
onCreateClick,
lang = 'en'
lang = "en",
}: ActionButtonsComponentProps) {
const t = getTranslation(lang);
return (
<div className="flex justify-end mb-4">
<div className="bg-white p-4 rounded-lg shadow mb-4">
<div className="flex items-center space-x-2">
<label className="text-sm font-medium">{t.actions}</label>
<div className="flex flex-wrap gap-2">
<button
onClick={onCreateClick}
className="px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600"
>
{t.create}
</button>
{/* Additional action buttons can be added here in the future */}
</div>
</div>
</div>
);
}

View File

@ -58,8 +58,6 @@ function TemplateApp({ lang = "en" }: TemplateProps) {
return (
<div className="container mx-auto px-4 py-6">
<h1 className="text-2xl font-bold mb-6">{t.title}</h1>
{/* Search Component */}
{mode === "list" && (
<SearchComponent

View File

@ -21,7 +21,6 @@ const language = {
showing: "Showing",
items: "items",
total: "Total",
// Search related translations
search: "Search",
searchPlaceholder: "Enter search term...",
searchFields: "Search in fields",
@ -43,6 +42,51 @@ const language = {
create: "Create",
save: "Save",
},
actions: "Actions",
},
tr: {
title: "Veri Yönetimi",
create: "Yeni Oluştur",
view: "Görüntüle",
update: "Güncelle",
createNew: "Yeni Oluştur",
back: "Geri",
cancel: "İptal",
submit: "Gönder",
noItemsFound: "Hiçbir kayıt bulunamadı",
previous: "Önceki",
next: "Sonraki",
page: "Sayfa",
of: "of",
itemsPerPage: "Sayfa başına kayıt:",
sortBy: "Sırala:",
loading: "Yükleniyor...",
error: "Veri yüklenirken hata:",
showing: "Gösteriliyor",
items: "kayıtlar",
total: "Toplam",
search: "Ara",
searchPlaceholder: "Ara...",
searchFields: "Ara alanları",
activeSearch: "Aktif arama",
clearSearch: "Temizle",
formLabels: {
title: "Başlık",
description: "Açıklama",
status: "Durum",
createdAt: "Oluşturulma",
},
status: {
active: "Aktif",
inactive: "Pasif",
},
buttons: {
view: "Görüntüle",
update: "Güncelle",
create: "Oluştur",
save: "Kaydet",
},
actions: "Eylemler",
},
// Add more languages as needed
};