Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Action Buttopn bug & misc tweaks #107

Merged
merged 7 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/app/needs/next-actions/components/NextActionsDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,13 @@ export default function NextActionsDisplay() {
To meet a need for {changeCase(need.name, "lower")}, which actions can you take next?
</h4>

{ actions.length > 0
? (
<NextActionsSection
need={need}
actions={actions}
onToggleAction={onToggleAction}
onDeleteAction={onDeleteAction}
mode={mode}
handleAddAction={handleAddAction}
/>
)
: (<p className="text-sm text-gray-500 ml-6">
No next actions available for this need.
</p>)
}
<NextActionsSection need={need}
actions={actions}
onToggleAction={onToggleAction}
onDeleteAction={onDeleteAction}
mode={mode}
handleAddAction={handleAddAction}
/>
</div>
);
})}
Expand Down
81 changes: 49 additions & 32 deletions src/app/needs/next-actions/components/NextActionsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,60 @@ export default function NextActionsSection({

return (
<>
<div className="mb-6 flex gap-5 flex-wrap">
{actions.map((action) => {
const highlighted = new Date(action.selectedExpiry) > new Date();
{ actions.length > 0
? <div className="mb-6 flex gap-5 flex-wrap">
{actions.map((action) => {
const highlighted = new Date(action.selectedExpiry) > new Date();

return (
<Button label={action.name}
key={action.id}
className={ mode === "destroy"
? "bg-twd-cube-red text-black font-normal"
: highlighted
? "bg-twd-primary-purple text-black font-normal"
: "bg-gray-600 text-white font-normal"
}
onClick={() => (mode === "destroy"
? onDeleteAction(action)
: onToggleAction(action)
)}
/>
);
})}
return (
<Button label={action.name}
key={action.id}
className={ mode === "destroy"
? "bg-twd-cube-red text-black font-normal"
: highlighted
? "bg-twd-primary-purple text-black font-normal"
: "bg-gray-600 text-white font-normal"
}
onClick={() => (mode === "destroy"
? onDeleteAction(action)
: onToggleAction(action)
)}
/>
);
})}

<button aria-label="Add Action"
onClick={() => setModalOpen(true)}
className="flex justify-center items-center"
>
<PlusCircleIcon className="w-7 m-auto" />
</button>
</div>
<button aria-label="Add Action"
onClick={() => setModalOpen(true)}
className="flex justify-center items-center"
>
<PlusCircleIcon className="w-7 m-auto"/>
</button>
</div>
: (
<div className="flex gap-5 flex-wrap items-center">
<p className="text-sm text-gray-500 ml-6">
No next actions available for this need.
</p>

<button aria-label="Add Action"
onClick={() => setModalOpen(true)}
className="flex justify-center items-center"
>
<PlusCircleIcon className="w-7 m-auto"/>
</button>
</div>
)
}

<Modal title="Add a New Action"
inputModal={true}
modalOpen={modalOpen}
inputModal={ true }
modalOpen={ modalOpen }
placeholder="What action might help meet this need?"
handleInputChange={handleInputChange}
forwardButton={{ label: "Add", action: handleSubmitAction }}
backButton={{
label: "Cancel",
handleInputChange={ handleInputChange }
forwardButton={{ label: "Add",
action: handleSubmitAction
}}
backButton={{ label: "Cancel",
action: () => {
setNewAction("");
setModalOpen(false);
Expand Down
2 changes: 1 addition & 1 deletion src/app/toolkit/info/categories-info/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function CategoriesInfoPage() {
return (
<>
{/* Header */}
<Header title="Categories" isInfoPage={true}/>
<Header title="Tags" isInfoPage={true}/>
<div className=" text-white min-h-screen px-10 py-6">

{/* Subheader */}
Expand Down
2 changes: 1 addition & 1 deletion src/app/toolkit/info/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function ToolkitInfoPage() {
<div className="mt-10">
<Link href="/toolkit/info/categories-info"
className="bg-twd-primary-purple text-white text-base px-6 py-3 rounded-full font-semibold">
Go to Tabs
Go to Tags
</Link>
</div>

Expand Down
Loading