forked from aws-samples/amplify-next-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #281 from cabcookie:improve-task-icons
Symbole für Aufgaben optimieren
- Loading branch information
Showing
13 changed files
with
193 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
import { MeetingTodo } from "@/api/useMeetingTodos"; | ||
import { Todo } from "@/api/useProjectTodos"; | ||
import { FC } from "react"; | ||
import DefaultAccordionItem from "../ui-elements/accordion/DefaultAccordionItem"; | ||
import { getTodoText } from "../ui-elements/editors/helpers/text-generation"; | ||
import TodoViewer from "../ui-elements/editors/todo-viewer/TodoViewer"; | ||
import NextAction from "../ui-elements/project-details/next-action"; | ||
|
||
type MeetingNextActionsProps = { | ||
todos: Todo[] | undefined; | ||
todos: MeetingTodo[] | undefined; | ||
mutate: (todo: MeetingTodo[], refresh: boolean) => void; | ||
}; | ||
|
||
const MeetingNextActions: FC<MeetingNextActionsProps> = ({ todos }) => | ||
todos && | ||
todos.length > 0 && ( | ||
const MeetingNextActions: FC<MeetingNextActionsProps> = ({ todos, mutate }) => { | ||
const mutateTodo = (todo: Todo, refresh: boolean) => | ||
todos && | ||
mutate( | ||
todos.map((t) => (t.todoId !== todo.todoId ? t : { ...t, ...todo })), | ||
refresh | ||
); | ||
|
||
return ( | ||
<DefaultAccordionItem | ||
value="next-actions" | ||
triggerTitle="Agreed Next Actions" | ||
triggerSubTitle={getTodoText(todos)} | ||
> | ||
<TodoViewer todos={todos} /> | ||
<div className="space-y-2"> | ||
{todos && todos.length === 0 ? ( | ||
<div className="text-sm text-muted-foreground">No next actions</div> | ||
) : ( | ||
todos?.map((todo) => ( | ||
<NextAction key={todo.todoId} {...{ todo, mutate: mutateTodo }} /> | ||
)) | ||
)} | ||
</div> | ||
</DefaultAccordionItem> | ||
); | ||
}; | ||
|
||
export default MeetingNextActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
components/ui-elements/project-details/next-action-detail-btn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Todo } from "@/api/useProjectTodos"; | ||
import { cn } from "@/lib/utils"; | ||
import { ArrowUpRightFromSquare } from "lucide-react"; | ||
import Link from "next/link"; | ||
import { FC } from "react"; | ||
|
||
interface NextActionDetailBtnProps { | ||
todo: Todo; | ||
className?: string; | ||
} | ||
|
||
const NextActionDetailBtn: FC<NextActionDetailBtnProps> = ({ | ||
todo, | ||
className, | ||
}) => ( | ||
<Link | ||
href={`/activities/${todo.activityId}`} | ||
target="_blank" | ||
className={cn( | ||
"flex flex-row items-baseline gap-1 text-muted-foreground hover:text-primary", | ||
className | ||
)} | ||
> | ||
<ArrowUpRightFromSquare className="w-4 h-4" /> | ||
<span className="text-sm -translate-y-0.5">Details</span> | ||
</Link> | ||
); | ||
|
||
export default NextActionDetailBtn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { finishTodo } from "@/api/todos/finish-todo"; | ||
import { Todo } from "@/api/useProjectTodos"; | ||
import { Checkbox } from "@/components/ui/checkbox"; | ||
import { FC } from "react"; | ||
import SimpleReadOnly from "../editors/simple-visualizer/SimpleReadOnly"; | ||
import NextActionDetailBtn from "./next-action-detail-btn"; | ||
|
||
interface NextActionProps { | ||
todo: Todo; | ||
mutate: (todo: Todo, refresh: boolean) => void; | ||
} | ||
|
||
const NextAction: FC<NextActionProps> = ({ todo, mutate }) => { | ||
const onFinish = () => | ||
finishTodo({ | ||
data: { todoId: todo.todoId, done: !todo.done }, | ||
options: { | ||
mutate: (refresh) => mutate({ ...todo, done: !todo.done }, refresh), | ||
}, | ||
}); | ||
|
||
return ( | ||
<div className="flex flex-row gap-1 items-start"> | ||
<> | ||
<div className="w-6 min-w-6 mt-[0.8rem]"> | ||
<Checkbox checked={todo.done} onCheckedChange={onFinish} /> | ||
</div> | ||
|
||
<div className="flex-1"> | ||
<SimpleReadOnly content={todo.todo.content || []} /> | ||
<NextActionDetailBtn todo={todo} /> | ||
</div> | ||
</> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NextAction; |
Oops, something went wrong.