Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Feb 8, 2024
1 parent c0037e3 commit 950e995
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion web/src/components/MainTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function MainTable({}: DashboardPageProps) {
weekOfYear: { equals: dashboardStore.calendar.week },
},
},
{ enabled: !!dashboardStore.activeMealBoardPlan },
{ enabled: !!dashboardStore.activeMealBoardPlan?.id },
);

useEffect(() => {
Expand Down
14 changes: 7 additions & 7 deletions web/src/components/pages/dashboard/table/TableContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "@dnd-kit/sortable";
import dayjs from "dayjs";
import { useTranslations } from "next-intl";
import { title } from "process";
import { useSnapshot } from "valtio";
import { CopyTableWeek } from "./CopyTableWeek";
import { TableGroupRow } from "./TableGroupRow";
Expand All @@ -26,14 +27,11 @@ interface RenderDayColumnProps {
}

const RenderDayColumn: React.FC<RenderDayColumnProps> = (props) => {
const t = useTranslations<"Meals">();
const dashboardStore = useSnapshot(DashboardStore);

const title = t(props.dayKey as keyof Messages["Meals"]);
const date = dayjs(dashboardStore.daysThatWeek.at(props.index)).format(
"DD.MM",
);
const text = `${title.at(0)?.toUpperCase()}${title.at(1)}. ${date}`;
const text = `${props.dayKey.at(0)?.toUpperCase()}${props.dayKey.at(1)}. ${date}`;

return (
<div key={props.dayKey} title={title}>
Expand Down Expand Up @@ -76,9 +74,11 @@ export function TableContext() {
/>
<CopyTableWeek />
</div>
{WEEK_DAYS.map((day, index) => (
<RenderDayColumn key={day} dayKey={day} index={index} />
))}
{WEEK_DAYS.map((day, index) => {
const title = t(day.toUpperCase() as keyof Messages["Meals"]);

return <RenderDayColumn key={title} dayKey={title} index={index} />;
})}
</div>

<DndContext
Expand Down

0 comments on commit 950e995

Please sign in to comment.