-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tm 1618 dashboard web design content management system for impact sto…
…ries admin and form (#902) * [TM-1617] add impact Story in dashboard * TM-1618 Dashboard - Web Design - Content Management System for Impact Stories (Admin and Form) * TM-1618 Fix styles for commentaries --------- Co-authored-by: diego-morales-flores-1996 <[email protected]>
- Loading branch information
1 parent
425e9eb
commit da954f0
Showing
14 changed files
with
625 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import DownloadIcon from "@mui/icons-material/GetApp"; | ||
import { Button, CreateButton, FilterButton, TopToolbar } from "react-admin"; | ||
import { When } from "react-if"; | ||
|
||
interface ListActionsProps { | ||
onExport?: () => void; | ||
} | ||
|
||
const ListActionsImpactStories = (props: ListActionsProps) => ( | ||
<TopToolbar> | ||
<FilterButton className="filter-button-page-admin" /> | ||
<When condition={!!props.onExport}> | ||
<Button className="button-page-admin" label="Export" startIcon={<DownloadIcon />} onClick={props.onExport} /> | ||
</When> | ||
<CreateButton className="filter-button-page-admin-blue" label="Add Story" /> | ||
</TopToolbar> | ||
); | ||
|
||
export default ListActionsImpactStories; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
import { ArrayField, ArrayFieldProps, ChipField, FunctionField, SingleFieldList } from "react-admin"; | ||
|
||
interface ChipFieldArrayProps extends Omit<ArrayFieldProps, "children"> { | ||
data: { id: string; label: string; className?: string }[]; | ||
emptyText?: string; | ||
} | ||
|
||
const ChipFieldArray: React.FC<ChipFieldArrayProps> = ({ data, emptyText, ...props }) => { | ||
if (!data.length) { | ||
return ( | ||
<div className="text-14 w-fit-content whitespace-nowrap rounded-[3px] bg-grey-200 px-2 text-grey-500"> | ||
{emptyText ?? "Not Provided"} | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<ArrayField {...props} record={{ [props.source!]: data }}> | ||
<SingleFieldList linkType={false}> | ||
<FunctionField | ||
render={(record?: { id: string; label: string; className?: string }) => | ||
record ? ( | ||
<ChipField | ||
record={{ label: record.label }} | ||
source="label" | ||
className={classNames("!h-fit !rounded-[3px] text-grey-500", record.className)} | ||
/> | ||
) : null | ||
} | ||
/> | ||
</SingleFieldList> | ||
</ArrayField> | ||
); | ||
}; | ||
|
||
export default ChipFieldArray; |
118 changes: 118 additions & 0 deletions
118
src/admin/modules/impactStories/components/ImpactStoriesEditForm.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,118 @@ | ||
import { t } from "@transifex/native"; | ||
import React from "react"; | ||
|
||
import Button from "@/components/elements/Button/Button"; | ||
import Dropdown from "@/components/elements/Inputs/Dropdown/Dropdown"; | ||
import { VARIANT_DROPDOWN_IMPACT_STORY } from "@/components/elements/Inputs/Dropdown/DropdownVariant"; | ||
import FileInput from "@/components/elements/Inputs/FileInput/FileInput"; | ||
import { VARIANT_FILE_INPUT_IMPACT_STORY } from "@/components/elements/Inputs/FileInput/FileInputVariants"; | ||
import Input from "@/components/elements/Inputs/Input/Input"; | ||
import Text from "@/components/elements/Text/Text"; | ||
import { ModalId } from "@/components/extensive/Modal/ModalConst"; | ||
import ModalStory from "@/components/extensive/Modal/ModalStory"; | ||
import { useModalContext } from "@/context/modal.provider"; | ||
|
||
import QuillEditor from "./QuillEditor"; | ||
|
||
const ImpactStoriesEditForm = () => { | ||
const { openModal } = useModalContext(); | ||
const ModalStoryOpen = (uuid: string) => { | ||
openModal(ModalId.MODAL_STORY, <ModalStory uuid={uuid} title={t("IMPACT STORY")} preview={true} />); | ||
}; | ||
return ( | ||
<div> | ||
<Text variant="text-24-bold" className="leading-[normal] text-darkCustom"> | ||
Edit Impact Story | ||
</Text> | ||
<div className="mt-5 flex flex-col gap-y-6"> | ||
<div className="grid grid-cols-2 gap-x-4"> | ||
<Input | ||
label="Title of Story" | ||
name="title" | ||
type="text" | ||
labelClassName="capitalize text-14-bold" | ||
className="text-14-light" | ||
/> | ||
<Input | ||
label="Date" | ||
name="title" | ||
type="date" | ||
labelClassName="capitalize text-14-bold" | ||
className="text-14-light" | ||
/> | ||
</div> | ||
<Dropdown | ||
label="Impact Category" | ||
options={[ | ||
{ | ||
title: "Gender equity", | ||
value: "gender-equity" | ||
}, | ||
{ | ||
title: "Youth engagement", | ||
value: "youth-engagement" | ||
}, | ||
{ | ||
title: "Ecosystem services", | ||
value: "ecosystem-services" | ||
} | ||
]} | ||
onChange={() => {}} | ||
labelClassName="capitalize text-14-bold" | ||
className="text-14-light" | ||
multiSelect={true} | ||
variant={VARIANT_DROPDOWN_IMPACT_STORY} | ||
/> | ||
<div className="grid grid-cols-2 gap-x-4"> | ||
<div> | ||
<FileInput | ||
onChange={() => {}} | ||
variant={VARIANT_FILE_INPUT_IMPACT_STORY} | ||
files={[]} | ||
allowMultiple={true} | ||
label="Thumbnail" | ||
labelClassName="capitalize text-14-bold" | ||
classNameTextOr="hidden" | ||
descriptionInput={ | ||
<Text variant="text-12-bold" className="text-center text-primary"> | ||
documents or images to help reviewer | ||
</Text> | ||
} | ||
/> | ||
</div> | ||
|
||
<Input | ||
label="Uploaded" | ||
name="title" | ||
type="text" | ||
labelClassName="capitalize text-14-bold" | ||
className="text-14-light" | ||
/> | ||
</div> | ||
<Text variant={"text-14-bold"}>Content</Text> | ||
<QuillEditor /> | ||
<div className="grid grid-cols-2 gap-x-4"> | ||
<Input | ||
label="Organization Details" | ||
name="title" | ||
type="text" | ||
labelClassName="capitalize text-14-bold" | ||
className="text-14-light" | ||
/> | ||
</div> | ||
<div className="flex justify-between"> | ||
<Button variant="semi-red">Delete</Button> | ||
<div className="flex items-center gap-x-2"> | ||
<Button variant="white-border">Save as draft</Button> | ||
<Button variant="white-border" onClick={() => ModalStoryOpen("impact-story-1")}> | ||
Preview | ||
</Button> | ||
<Button variant="primary">Publish</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ImpactStoriesEditForm; |
Oops, something went wrong.