chore(format): Prettier auf day-entry.ts + TopNav.tsx anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der myWeek-Query und dem Woche-Nav-Tab. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a0a2392e3d
commit
4311eadf50
2 files changed
+19
-14
No files matched your search
@@ -104,11 +104,7 @@ export async function applyWorkdayBoundary(db: Db, userId: string, now: Date): P
|
|||||||
* 06:00 des Folgetags — also noch fortsetzbar). `null`, wenn kein laufender/heutiger
|
* 06:00 des Folgetags — also noch fortsetzbar). `null`, wenn kein laufender/heutiger
|
||||||
* Tag existiert (→ Frontend zeigt das Einstempel-Formular).
|
* Tag existiert (→ Frontend zeigt das Einstempel-Formular).
|
||||||
*/
|
*/
|
||||||
export async function getActiveEntry(
|
export async function getActiveEntry(db: Db, userId: string, now: Date): Promise<DayEntry | null> {
|
||||||
db: Db,
|
|
||||||
userId: string,
|
|
||||||
now: Date,
|
|
||||||
): Promise<DayEntry | null> {
|
|
||||||
await applyWorkdayBoundary(db, userId, now);
|
await applyWorkdayBoundary(db, userId, now);
|
||||||
const entry = (
|
const entry = (
|
||||||
await db
|
await db
|
||||||
@@ -130,11 +126,9 @@ export const dayEntryRouter = router({
|
|||||||
*/
|
*/
|
||||||
todayTeam: protectedProcedure.query(async ({ ctx }) => {
|
todayTeam: protectedProcedure.query(async ({ ctx }) => {
|
||||||
const date = todayIso();
|
const date = todayIso();
|
||||||
const entries = await ctx.db
|
const entries = await ctx.db.select().from(dayEntry).where(eq(dayEntry.date, date));
|
||||||
.select()
|
if (entries.length === 0)
|
||||||
.from(dayEntry)
|
return [] as Array<{ userId: string; entryStatus: string; todos: Todo[] }>;
|
||||||
.where(eq(dayEntry.date, date));
|
|
||||||
if (entries.length === 0) return [] as Array<{ userId: string; entryStatus: string; todos: Todo[] }>;
|
|
||||||
const ids = entries.map((e) => e.id);
|
const ids = entries.map((e) => e.id);
|
||||||
const todos = await ctx.db
|
const todos = await ctx.db
|
||||||
.select()
|
.select()
|
||||||
@@ -339,7 +333,8 @@ export const dayEntryRouter = router({
|
|||||||
if (!entry) {
|
if (!entry) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: 'BAD_REQUEST',
|
code: 'BAD_REQUEST',
|
||||||
message: 'Kein fortsetzbarer Arbeitstag — der letzte Tag ist abgeschlossen. Stempel neu ein.',
|
message:
|
||||||
|
'Kein fortsetzbarer Arbeitstag — der letzte Tag ist abgeschlossen. Stempel neu ein.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!entry.checkedOutAt) return entry; // läuft bereits
|
if (!entry.checkedOutAt) return entry; // läuft bereits
|
||||||
@@ -484,7 +479,10 @@ export const dayEntryRouter = router({
|
|||||||
.mutation(async ({ ctx, input }) => {
|
.mutation(async ({ ctx, input }) => {
|
||||||
const entry = await getActiveEntry(ctx.db, ctx.user.id, new Date());
|
const entry = await getActiveEntry(ctx.db, ctx.user.id, new Date());
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
throw new TRPCError({ code: 'BAD_REQUEST', message: 'Du bist gerade nicht eingestempelt.' });
|
throw new TRPCError({
|
||||||
|
code: 'BAD_REQUEST',
|
||||||
|
message: 'Du bist gerade nicht eingestempelt.',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const existing = await ctx.db
|
const existing = await ctx.db
|
||||||
.select({ id: todo.id })
|
.select({ id: todo.id })
|
||||||
@@ -632,7 +630,11 @@ export const dayEntryRouter = router({
|
|||||||
|
|
||||||
const ids = entries.map((e) => e.id);
|
const ids = entries.map((e) => e.id);
|
||||||
const todoRows = ids.length
|
const todoRows = ids.length
|
||||||
? await ctx.db.select().from(todo).where(inArray(todo.dayEntryId, ids)).orderBy(asc(todo.order))
|
? await ctx.db
|
||||||
|
.select()
|
||||||
|
.from(todo)
|
||||||
|
.where(inArray(todo.dayEntryId, ids))
|
||||||
|
.orderBy(asc(todo.order))
|
||||||
: [];
|
: [];
|
||||||
const todosByEntry = new Map<string, Todo[]>();
|
const todosByEntry = new Map<string, Todo[]>();
|
||||||
for (const t of todoRows) {
|
for (const t of todoRows) {
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ export function TopNav() {
|
|||||||
className="mx-auto flex h-14 max-w-[1280px] items-center gap-2 px-6"
|
className="mx-auto flex h-14 max-w-[1280px] items-center gap-2 px-6"
|
||||||
aria-label="Hauptnavigation"
|
aria-label="Hauptnavigation"
|
||||||
>
|
>
|
||||||
<NavLink to="/dashboard" className="flex items-center gap-1.5 font-bold text-[var(--color-ink)]">
|
<NavLink
|
||||||
|
to="/dashboard"
|
||||||
|
className="flex items-center gap-1.5 font-bold text-[var(--color-ink)]"
|
||||||
|
>
|
||||||
<span>{voice.appName}</span>
|
<span>{voice.appName}</span>
|
||||||
<ToolCtrlLogo size={18} />
|
<ToolCtrlLogo size={18} />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|||||||
Reference in new issue
Block a user