feat(odin): personalized greeting hero on the new-conversation screen

Time-based Czech greeting + the user's first name (e.g. "Dobrý večer, Admin")
above the big gradient "Odin" wordmark, with a stylish description line. Drop
the redundant mark from the hero (it lives on the nav item + thinking state).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-08 20:51:00 +02:00
parent ab12f9d791
commit 1e21c12f33
2 changed files with 56 additions and 21 deletions

View File

@@ -62,10 +62,26 @@ function summaryNote(reviews: ReviewInvoice[]): string {
export default function OdinChat() {
const alert = useAlert();
const qc = useQueryClient();
const { hasPermission } = useAuth();
const { user, hasPermission } = useAuth();
// Saving an extracted invoice hits /received-invoices (needs invoices.create);
// Odin itself only needs ai.use, so the Save affordance is gated separately.
const canSave = hasPermission("invoices.create");
// Time-based Czech greeting + the user's first name (client-local time).
const greeting = (() => {
const h = new Date().getHours();
const part =
h < 9
? "Dobré ráno"
: h < 12
? "Dobrý den"
: h < 18
? "Dobré odpoledne"
: "Dobrý večer";
const name = (user?.fullName || user?.username || "")
.trim()
.split(/\s+/)[0];
return name ? `${part}, ${name}` : part;
})();
const { data: usage } = useQuery(aiUsageOptions());
const { data: convData, isPending: convPending } = useQuery(
aiConversationsOptions(),
@@ -425,6 +441,7 @@ export default function OdinChat() {
turns={turns}
busy={busy}
loading={messagesLoading}
greeting={greeting}
threadRef={threadRef}
/>