Skip to content

Commit 9fedcc6

Browse files
committed
fix: improve handling of team member and task data in project management
- Updated AssigneeSelect to handle cases where team member names may be undefined. - Made the description field in CreateProjectModal required for better data integrity. - Enhanced ExportImportControls to map member emails by ID for easier access and added an assigneeEmail column in task exports. - Refactored ProjectManagement to improve team merging logic and ensure proper handling of incoming tasks and members, including better ID resolution and state management.
1 parent a51e4b0 commit 9fedcc6

File tree

4 files changed

+201
-137
lines changed

4 files changed

+201
-137
lines changed

frontend/src/components/AssigneeSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function AssigneeSelect({
4040
const theme = makeSelectTheme(dark);
4141

4242
const options = team.map((t: TeamMember) => {
43-
const hue = hashStr(t.name) % 360; // 0..359
43+
const hue = hashStr(t.name ? t.name : "A") % 360; // 0..359
4444
// choose visible text color and dot background depending on mode:
4545
const dot = dark ? hsla(hue, 70, 55, 0.95) : hsl(hue, 75, 45);
4646
const text = dark ? hsl(hue, 70, 75) : hsl(hue, 75, 25);

frontend/src/components/CreateProjectModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ export default function CreateProjectModal({
129129

130130
<label className="block text-sm mb-4">
131131
<span className="text-xs text-gray-500 dark:text-gray-400">
132-
Description (optional)
132+
Description
133133
</span>
134134
<textarea
135135
value={description}
136+
required
136137
onChange={(e) => setDescription(e.target.value)}
137138
placeholder="Short description"
138139
className="mt-1 block w-full px-3 py-2 rounded-lg bg-slate-100 dark:bg-gray-900 border border-gray-100 dark:border-gray-700 text-sm outline-none focus:ring-1 focus:ring-sky-300 min-h-[96px]"

frontend/src/components/ExportImportControls.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ export default function ExportImportControls({
163163
const project = projects?.find((p) => p.id === selectedProjectId);
164164
const projectWorkspaceId = project?.workspaceId;
165165

166+
// Build a map for quick lookup of member email by id
167+
const memberEmailById: Map<string, string> = new Map(
168+
(team || []).map((m) => [String(m.id), String(m.email ?? "")])
169+
);
170+
166171
// Team rows
167172
const tmRows = team
168173
.filter((m) => {
@@ -210,6 +215,12 @@ export default function ExportImportControls({
210215
const updatedDescription =
211216
descInfo?.html ?? (t as any).description ?? "";
212217

218+
// find assignee email if available
219+
const assigneeIdStr = t.assigneeId ? String(t.assigneeId) : "";
220+
const assigneeEmail = assigneeIdStr
221+
? memberEmailById.get(assigneeIdStr) ?? ""
222+
: "";
223+
213224
return {
214225
id: truncateForExcel(t.id ?? "", `task.id:${t.id ?? ""}`),
215226
clientId: truncateForExcel(
@@ -233,6 +244,11 @@ export default function ExportImportControls({
233244
t.assigneeId ?? "",
234245
`task.assigneeId:${t.id ?? ""}`
235246
),
247+
// NEW: add assigneeEmail column
248+
assigneeEmail: truncateForExcel(
249+
assigneeEmail,
250+
`task.assigneeEmail:${t.id ?? ""}`
251+
),
236252
priority: truncateForExcel(
237253
t.priority ?? "",
238254
`task.priority:${t.id ?? ""}`

0 commit comments

Comments
 (0)