refactor(ui): simplify dashboard headers and actions
This commit is contained in:
@@ -48,9 +48,6 @@ export function AnalyticsClient({ data }: AnalyticsClientProps) {
|
||||
<h1 className="text-3xl font-semibold tracking-normal text-foreground">
|
||||
Performans ve Finans Analizi
|
||||
</h1>
|
||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
||||
Müşteri bazlı gelirler, görev tamamlama oranları ve proje ilerleme grafikleri.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
|
||||
@@ -91,9 +91,6 @@ export function CalendarClient({ events, clients, projects, tasks }: CalendarCli
|
||||
<div className="flex flex-col gap-4 border-b border-border pb-5 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<h1 className="text-3xl font-semibold tracking-normal text-foreground">Takvim</h1>
|
||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
||||
Toplantı, odak bloğu, deadline, kişisel ve finans etkinliklerini yönet.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<CalendarEventDialog
|
||||
@@ -116,13 +113,13 @@ export function CalendarClient({ events, clients, projects, tasks }: CalendarCli
|
||||
<p className="text-sm text-muted-foreground">{events.length} etkinlik</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button type="button" variant="outline" onClick={() => shiftMonth(-1)}>
|
||||
<Button effect="shine" type="button" variant="secondary" onClick={() => shiftMonth(-1)}>
|
||||
Önceki
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => setMonthDate(new Date())}>
|
||||
<Button effect="shine" type="button" variant="secondary" onClick={() => setMonthDate(new Date())}>
|
||||
Bugün
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => shiftMonth(1)}>
|
||||
<Button effect="shine" type="button" variant="secondary" onClick={() => shiftMonth(1)}>
|
||||
Sonraki
|
||||
</Button>
|
||||
</div>
|
||||
@@ -143,13 +140,15 @@ export function CalendarClient({ events, clients, projects, tasks }: CalendarCli
|
||||
const isSelected = selectedDate === day.key;
|
||||
|
||||
return (
|
||||
<button
|
||||
<Button effect="shine"
|
||||
key={day.key}
|
||||
type="button"
|
||||
variant={isSelected ? "default" : "secondary"}
|
||||
onClick={() => setSelectedDate(day.key)}
|
||||
className={`min-h-28 border-b border-r border-border p-2 text-left transition-colors last:border-r-0 hover:bg-muted/40 ${
|
||||
!day.inMonth ? "bg-muted/20 text-muted-foreground" : "bg-background"
|
||||
} ${isSelected ? "ring-2 ring-inset ring-primary" : ""}`}
|
||||
radius="none"
|
||||
className={`min-h-28 w-full justify-start whitespace-normal border-b border-r p-2 text-left last:border-r-0 ${
|
||||
!day.inMonth ? "opacity-60" : ""
|
||||
}`}
|
||||
>
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<span className="text-sm font-medium">{day.date.getDate()}</span>
|
||||
@@ -167,7 +166,7 @@ export function CalendarClient({ events, clients, projects, tasks }: CalendarCli
|
||||
<div className="text-xs text-muted-foreground">+{dayEvents.length - 3}</div>
|
||||
) : null}
|
||||
</div>
|
||||
</button>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -251,7 +250,7 @@ function EventList({
|
||||
<CalendarEventDialog mode="edit" event={event} clients={clients} projects={projects} tasks={tasks} />
|
||||
<form action={deleteCalendarEventRecord}>
|
||||
<input type="hidden" name="id" value={event.id} />
|
||||
<Button type="submit" variant="outline" className="h-9 gap-2 text-rose-600">
|
||||
<Button effect="shine" type="submit" variant="secondary" className="gap-2 text-rose-600">
|
||||
<Trash2 className="h-4 w-4" />
|
||||
Sil
|
||||
</Button>
|
||||
@@ -303,7 +302,7 @@ function CalendarEventDialog({
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="h-9 gap-2" variant={mode === "create" ? "default" : "outline"}>
|
||||
<Button effect="shine" className="gap-2" variant={mode === "create" ? "default" : "secondary"}>
|
||||
{mode === "create" ? <Plus className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}
|
||||
{mode === "create" ? "Etkinlik ekle" : "Düzenle"}
|
||||
</Button>
|
||||
@@ -321,7 +320,7 @@ function CalendarEventDialog({
|
||||
</div>
|
||||
|
||||
<DialogFooter className="shrink-0 border-t border-border bg-background p-5">
|
||||
<Button type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
<Button variant="default" effect="shine" type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
{mode === "create" ? <Plus className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}
|
||||
{isSubmitting ? "Kaydediliyor" : mode === "create" ? "Etkinliği ekle" : "Değişiklikleri kaydet"}
|
||||
</Button>
|
||||
|
||||
@@ -69,9 +69,6 @@ export function DashboardClient({ data }: DashboardClientProps) {
|
||||
<h1 className="text-3xl font-semibold tracking-normal text-foreground">
|
||||
Dashboard
|
||||
</h1>
|
||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
||||
İş performansını, gelirlerini ve günlük durumunu takip et.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
|
||||
@@ -148,9 +148,6 @@ export function FinanceClient({ transactions, clients, projects }: FinanceClient
|
||||
<h1 className="text-3xl font-semibold tracking-normal text-foreground">
|
||||
Finans işlemleri
|
||||
</h1>
|
||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
||||
Gelir, gider, ödeme durumu ve proje/müşteri bağlantılarını takip et.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<AIFinanceDialog />
|
||||
@@ -170,20 +167,20 @@ export function FinanceClient({ transactions, clients, projects }: FinanceClient
|
||||
</div>
|
||||
<div className="flex shrink-0 gap-2">
|
||||
<Button
|
||||
effect="shine"
|
||||
type="button"
|
||||
variant="outline"
|
||||
variant="secondary"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
aria-label="Önceki finans özet kartları"
|
||||
onClick={() => scrollSummary(-1)}
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
effect="shine"
|
||||
type="button"
|
||||
variant="outline"
|
||||
variant="secondary"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
aria-label="Sonraki finans özet kartları"
|
||||
onClick={() => scrollSummary(1)}
|
||||
>
|
||||
@@ -207,7 +204,7 @@ export function FinanceClient({ transactions, clients, projects }: FinanceClient
|
||||
scrollSummary(1);
|
||||
}
|
||||
}}
|
||||
className="tiny-scrollbar flex snap-x snap-mandatory gap-3 overflow-x-auto scroll-smooth pb-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||
className="flex snap-x snap-mandatory gap-3 overflow-x-auto scroll-smooth pb-3 [scrollbar-width:none] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{summaryCards.map((card) => (
|
||||
<StatCard
|
||||
@@ -350,7 +347,7 @@ function TransactionRow({
|
||||
<FinanceDialog mode="edit" transaction={transaction} clients={clients} projects={projects} />
|
||||
<form action={deleteFinanceTransactionRecord}>
|
||||
<input type="hidden" name="id" value={transaction.id} />
|
||||
<Button type="submit" variant="outline" className="h-9 gap-2 text-rose-600">
|
||||
<Button effect="shine" type="submit" variant="secondary" className="gap-2 text-rose-600">
|
||||
<Trash2 className="h-4 w-4" />
|
||||
Sil
|
||||
</Button>
|
||||
@@ -395,7 +392,7 @@ function FinanceDialog({
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant={mode === "create" ? "default" : "outline"} className="h-9 gap-2">
|
||||
<Button effect="shine" variant={mode === "create" ? "default" : "secondary"} className="gap-2">
|
||||
{mode === "create" ? <Plus className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}
|
||||
{mode === "create" ? "İşlem ekle" : "Düzenle"}
|
||||
</Button>
|
||||
@@ -411,7 +408,7 @@ function FinanceDialog({
|
||||
<FinanceFormFields transaction={transaction} clients={clients} projects={projects} />
|
||||
</div>
|
||||
<DialogFooter className="shrink-0 border-t border-border bg-background p-5">
|
||||
<Button type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
<Button variant="default" effect="shine" type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
{mode === "create" ? <Plus className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}
|
||||
{isSubmitting ? "Kaydediliyor" : mode === "create" ? "İşlemi ekle" : "Değişiklikleri kaydet"}
|
||||
</Button>
|
||||
@@ -657,7 +654,7 @@ function AIFinanceDialog() {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant="outline" className="gap-2 bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100 hover:text-indigo-800">
|
||||
<Button effect="shine" variant="secondary" className="gap-2">
|
||||
<Brain className="h-4 w-4" />
|
||||
AI Analizi
|
||||
</Button>
|
||||
@@ -676,7 +673,7 @@ function AIFinanceDialog() {
|
||||
<div className="py-4">
|
||||
{!result && !loading && (
|
||||
<div className="text-center py-10">
|
||||
<Button onClick={handleAnalyze} className="gap-2 bg-indigo-600 hover:bg-indigo-700 text-white">
|
||||
<Button variant="default" effect="shine" onClick={handleAnalyze} className="gap-2">
|
||||
<Brain className="h-4 w-4" />
|
||||
Raporu Oluştur
|
||||
</Button>
|
||||
@@ -699,8 +696,8 @@ function AIFinanceDialog() {
|
||||
|
||||
{result && (
|
||||
<DialogFooter className="gap-2 sm:gap-0">
|
||||
<Button variant="outline" onClick={() => setOpen(false)}>Kapat</Button>
|
||||
<Button variant="default" onClick={handleAnalyze} className="gap-2">
|
||||
<Button effect="shine" variant="secondary" onClick={() => setOpen(false)}>Kapat</Button>
|
||||
<Button effect="shine" variant="default" onClick={handleAnalyze} className="gap-2">
|
||||
<Brain className="h-4 w-4" />
|
||||
Yeniden Oluştur
|
||||
</Button>
|
||||
|
||||
@@ -81,9 +81,6 @@ export function JournalClient({ logs }: JournalClientProps) {
|
||||
<h1 className="text-3xl font-semibold tracking-normal text-foreground">
|
||||
Mood ve enerji
|
||||
</h1>
|
||||
<p className="mt-1 max-w-2xl text-sm text-muted-foreground">
|
||||
Günlük ruh hali, enerji ve çalışma memnuniyetini takip ederek kişisel kapasite trendini gör.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:flex-row">
|
||||
@@ -233,7 +230,7 @@ function DailyLogRow({ log }: { log: DailyLogItem }) {
|
||||
<DailyLogDialog mode="edit" log={log} />
|
||||
<form action={deleteDailyLogRecord}>
|
||||
<input type="hidden" name="id" value={log.id} />
|
||||
<Button type="submit" variant="outline" className="h-9 gap-2 text-rose-600">
|
||||
<Button effect="shine" type="submit" variant="secondary" className="gap-2 text-rose-600">
|
||||
<Trash2 className="h-4 w-4" />
|
||||
Sil
|
||||
</Button>
|
||||
@@ -269,7 +266,7 @@ function DailyLogDialog({ mode, log }: { mode: "create" | "edit"; log?: DailyLog
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant={mode === "create" ? "default" : "outline"} className="h-9 gap-2">
|
||||
<Button effect="shine" variant={mode === "create" ? "default" : "secondary"} className="gap-2">
|
||||
{mode === "create" ? <Plus className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}
|
||||
{mode === "create" ? "Günlük ekle" : "Düzenle"}
|
||||
</Button>
|
||||
@@ -289,7 +286,7 @@ function DailyLogDialog({ mode, log }: { mode: "create" | "edit"; log?: DailyLog
|
||||
</div>
|
||||
|
||||
<DialogFooter className="shrink-0 border-t border-border bg-background p-5">
|
||||
<Button type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
<Button variant="default" effect="shine" type="submit" disabled={isSubmitting} className="w-full gap-2 sm:w-auto">
|
||||
{isSubmitting ? "Kaydediliyor" : mode === "create" ? "Kaydı ekle" : "Değişiklikleri kaydet"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
@@ -320,21 +317,18 @@ function DailyLogFormFields({ log }: { log?: DailyLogItem }) {
|
||||
label="Mood skoru"
|
||||
value={moodScore}
|
||||
onChange={setMoodScore}
|
||||
tone="primary"
|
||||
/>
|
||||
<ScorePicker
|
||||
name="energy_score"
|
||||
label="Enerji skoru"
|
||||
value={energyScore}
|
||||
onChange={setEnergyScore}
|
||||
tone="green"
|
||||
/>
|
||||
<ScorePicker
|
||||
name="work_satisfaction_score"
|
||||
label="Çalışma memnuniyeti"
|
||||
value={satisfactionScore}
|
||||
onChange={setSatisfactionScore}
|
||||
tone="blue"
|
||||
/>
|
||||
|
||||
<div className="grid gap-2">
|
||||
@@ -355,13 +349,11 @@ function ScorePicker({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
tone,
|
||||
}: {
|
||||
name: string;
|
||||
label: string;
|
||||
value: number;
|
||||
onChange: (value: number) => void;
|
||||
tone: "primary" | "green" | "blue";
|
||||
}) {
|
||||
return (
|
||||
<div className="grid gap-2">
|
||||
@@ -372,18 +364,15 @@ function ScorePicker({
|
||||
<input type="hidden" name={name} value={value} />
|
||||
<div className="grid grid-cols-5 gap-2">
|
||||
{[1, 2, 3, 4, 5].map((score) => (
|
||||
<button
|
||||
<Button
|
||||
effect="shine"
|
||||
key={score}
|
||||
type="button"
|
||||
variant={value === score ? "default" : "secondary"}
|
||||
onClick={() => onChange(score)}
|
||||
className={`h-10 rounded-sm border text-sm font-semibold transition-colors ${
|
||||
value === score
|
||||
? getScoreActiveClass(tone)
|
||||
: "border-border bg-background text-muted-foreground hover:border-primary/40"
|
||||
}`}
|
||||
>
|
||||
{score}
|
||||
</button>
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
@@ -446,12 +435,6 @@ function average(values: number[]) {
|
||||
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
||||
}
|
||||
|
||||
function getScoreActiveClass(tone: "primary" | "green" | "blue") {
|
||||
if (tone === "green") return "border-emerald-600 bg-emerald-600 text-white";
|
||||
if (tone === "blue") return "border-blue-600 bg-blue-600 text-white";
|
||||
return "border-primary bg-primary text-primary-foreground";
|
||||
}
|
||||
|
||||
function formatDate(value: string) {
|
||||
return new Intl.DateTimeFormat("tr-TR", {
|
||||
day: "2-digit",
|
||||
|
||||
Reference in New Issue
Block a user