Skip to content

Commit

Permalink
Add color changing
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHoodHacker committed Dec 1, 2023
1 parent 51e2c28 commit 8923e2d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
3 changes: 2 additions & 1 deletion client/src/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ interface Task {
posY: number;
// posZ: number;
color: string;
textColor?: string;
description?: string;
status?: string;
priority?: string;
deadline?: string;
timeNeeded?: string;
assignees?: User[];
arrowsOut?: Arrow[];
arrowsIn?: Arrow[];
timeNeeded?: string;
}
interface Arrow {
id: number;
Expand Down
32 changes: 29 additions & 3 deletions client/src/components/Board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export default function Board() {
height: 100,
posX: 300,
posY: 100,
color: "#f7d9c4"
color: "#f7d9c4",
textColor: "#b35b5b"
},
{
id: 5,
Expand All @@ -91,7 +92,31 @@ export default function Board() {
id: 1,
from: 1,
to: 2,
color: "#0000ff"
color: "#7f00f7"
},
{
id: 2,
from: 1,
to: 3,
color: "#7f00f7"
},
{
id: 3,
from: 4,
to: 5,
color: "#7f00f7"
},
{
id: 4,
from: 3,
to: 5,
color: "#7f00f7"
},
{
id: 5,
from: 2,
to: 5,
color: "#7f00f7"
}
],
users: [
Expand Down Expand Up @@ -137,7 +162,7 @@ export default function Board() {
_selected_task: null
});
const [arrowToolState, setArrowToolState] = useState<ArrowToolState>({
color: "#0000ff",
color: "#7f00f7",
_firstId: -1
});

Expand Down Expand Up @@ -303,6 +328,7 @@ export default function Board() {
key={idx}
start={arrow.from.toString()}
end={arrow.to.toString()}
color={arrow.color}
/>
))}
</Xwrapper>
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/Task/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ export default function Task(props: Props) {
width: `${task.width}px`,
height: `${task.height}px`,
background: task.color,
color: task.textColor,
}}
ref={target_ref}
onClick={() => handleTaskClick(task.id)}
>
<p>{useDeferredValue(task.title)}</p>
<p>
{useDeferredValue(task.title)}
</p>
</div>
{isMoveable ? (
<Moveable
Expand Down
27 changes: 27 additions & 0 deletions client/src/components/TaskDetailsPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ export default function TaskDetailsPane(props: Props) {
placeholder="Untitled task"
rows={1}
spellCheck={false}
autoFocus={true}
// Move cursor to end of text
onFocus={(e) => {e.target.value = ''; e.target.value = task.title;}}
onChange={(e) => setTitle(e.target.value)}
/>
</span>
Expand Down Expand Up @@ -294,6 +297,30 @@ export default function TaskDetailsPane(props: Props) {
onChange={(e) => setTimeNeeded(e.target.value)}
/>
</span>
<span className="flex flex-col">
<span>Task Color</span>
<input
type="color"
className="border-2 border-surface-150 w-full rounded-md bg-transparent"
defaultValue={task.color}
onChange={(e) => handleTaskUpdate({
...task,
color: e.target.value
})}
/>
</span>
<span className="flex flex-col">
<span>Text Color</span>
<input
type="color"
className="border-2 border-surface-150 w-full rounded-md bg-transparent"
defaultValue={task.textColor}
onChange={(e) => handleTaskUpdate({
...task,
textColor: e.target.value
})}
/>
</span>
</div>
<span className="flex flex-col">
<span>
Expand Down

0 comments on commit 8923e2d

Please sign in to comment.