feat(plan): show project name instead of raw id in cell
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { GridData, ResolvedCell } from "../lib/queries/plan";
|
||||
import type { Project } from "../lib/queries/projects";
|
||||
import PlanRangeChips from "./PlanRangeChips";
|
||||
|
||||
interface Props {
|
||||
data: GridData | undefined;
|
||||
canEdit: boolean;
|
||||
projects: Project[];
|
||||
onCellClick: (
|
||||
userId: number,
|
||||
date: string,
|
||||
@@ -32,7 +34,12 @@ function isWeekend(dateStr: string): boolean {
|
||||
return day === 0 || day === 6;
|
||||
}
|
||||
|
||||
export default function PlanGrid({ data, canEdit, onCellClick }: Props) {
|
||||
export default function PlanGrid({
|
||||
data,
|
||||
canEdit,
|
||||
projects,
|
||||
onCellClick,
|
||||
}: Props) {
|
||||
if (!data)
|
||||
return (
|
||||
<div className="admin-loading">
|
||||
@@ -72,7 +79,16 @@ export default function PlanGrid({ data, canEdit, onCellClick }: Props) {
|
||||
className={cls}
|
||||
onClick={() => onCellClick(u.id, date, cell)}
|
||||
>
|
||||
<PlanRangeChips cell={cell} readonly={!canEdit} />
|
||||
<PlanRangeChips
|
||||
cell={cell}
|
||||
project={
|
||||
cell?.project_id
|
||||
? (projects.find((p) => p.id === cell.project_id) ??
|
||||
null)
|
||||
: null
|
||||
}
|
||||
readonly={!canEdit}
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user