Skip to content

Commit

Permalink
add free form stats
Browse files Browse the repository at this point in the history
  • Loading branch information
tuckner committed Jan 10, 2024
1 parent 777e9ab commit 1c830a1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/components/Board/AddTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ export default function AddTask({ handleClose, tasks }: Props) {
name: tasks.name,
description: tasks.description,
category: tasks.category,
time_saved: tasks.time_saved,
stats: tasks.stats,
techniques: tasks.techniques,
subtasks: tasks.subtasks,
}
: {
id: generateRandomNumber(),
name: "",
description: "",
time_saved: "",
stats: [],
category: selectedColumn,
techniques: [],
subtasks: [],
Expand Down
14 changes: 9 additions & 5 deletions src/components/Board/TaskDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ export default function TaskDetails({
</div>
<div className="text-sm my-2">
<p>A{tasks.id}</p>
</div>
{tasks.time_saved && (
<div className="text-xs text-gray my-2">
<p>Time saved: {tasks.time_saved}</p>
</div>
</div>
{tasks.stats && (
<>
{tasks.stats.map((stat: { name: string; value: string }, index: number) => (
<p key={index} className="text-xs text-gray my-2">
{`${stat.name}: ${stat.value}`}
</p>
))}
</>
)}
<div>
<p className="text-sm my-4">
Expand Down
16 changes: 8 additions & 8 deletions src/components/Board/TaskItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import AddTask from "./AddTask";
import TaskDetails from "./TaskDetails";
import { Draggable } from "@hello-pangea/dnd";
import { BsCircleFill } from "react-icons/bs";
// import { randomColor } from "utilis";

interface Props {
tasks: ITask;
Expand Down Expand Up @@ -39,7 +38,6 @@ export default function TaskItem({ tasks, index }: Props) {
{tasks.subtasks.map((subtask, index) => (
<div key={index}>
<p className="text-xs text-gray font-bold">
{" "}
{subtask.title}
</p>
</div>
Expand All @@ -48,15 +46,17 @@ export default function TaskItem({ tasks, index }: Props) {
<div className="flex align-top justify-between">
<p className="font-bold pr-2">{tasks.name}</p>
<p className="pt-1 text-xs text-slate font-bold">
{" "}
A{tasks.id}
</p>
</div>
{tasks.time_saved && (
<p className="pt-2 text-xs text-gray font-bold">
{" "}
Time saved: {tasks.time_saved}
</p>
{tasks.stats && (
<>
{tasks.stats.map((stat: { name: string; value: string }, index: number) => (
<p key={index} className="pt-2 text-xs text-gray font-bold">
{`${stat.name}: ${stat.value}`}
</p>
))}
</>
)}
<div className="flex justify-between items-center pt-10">
<p className="text-xs text-gray font-bold">
Expand Down
11 changes: 8 additions & 3 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface IBoard {
name: string;
description: string;
category: string;
time_saved: string;
stats: IStat[];
techniques: string[];
subtasks: { id:string,
title: string;
Expand All @@ -19,6 +19,11 @@ export interface IBoard {
}[];
}

export interface IStat {
name: string;
value: string;
}

export interface IColumn {
name: string;
id:string,
Expand All @@ -27,7 +32,7 @@ export interface IColumn {
name: string;
description: string;
category: string;
time_saved: string;
stats: IStat[];
techniques: string[];
subtasks: {
id:string,
Expand All @@ -42,7 +47,7 @@ export interface ITask {
name: string;
description: string;
category: string;
time_saved: string;
stats: IStat[];
techniques: string[];
subtasks: {
id:string,
Expand Down

0 comments on commit 1c830a1

Please sign in to comment.