-
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 #1226 from cultuurnet/feature/PPF-462
- Loading branch information
Showing
12 changed files
with
163 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
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
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
73 changes: 73 additions & 0 deletions
73
resources/ts/Components/Integrations/Detail/OrganizersInfo.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,73 @@ | ||
import React from "react"; | ||
import { Heading } from "../../Heading"; | ||
import { useTranslation } from "react-i18next"; | ||
import type { Integration } from "../../../types/Integration"; | ||
import { Card } from "../../Card"; | ||
import { CopyText } from "../../CopyText"; | ||
import { ButtonIcon } from "../../ButtonIcon"; | ||
import { faPencil, faTrash } from "@fortawesome/free-solid-svg-icons"; | ||
import type { Organizer } from "../../../types/Organizer"; | ||
import { groupBy } from "lodash"; | ||
import { ButtonPrimary } from "../../ButtonPrimary"; | ||
|
||
type Props = Integration & { organizers: Organizer[] }; | ||
|
||
const OrganizersSection = ({ | ||
sectionName, | ||
organizers, | ||
}: { | ||
organizers: Organizer[]; | ||
sectionName: Organizer["status"]; | ||
}) => { | ||
const { t, i18n } = useTranslation(); | ||
if (!organizers?.length) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<Heading level={4} className="font-semibold"> | ||
{sectionName} | ||
</Heading> | ||
{organizers.map((organizer) => ( | ||
<Card key={organizer.id}> | ||
<div className="grid grid-cols-[1fr,2fr,auto] gap-x-4 items-center"> | ||
<h1 className={"font-bold"}>{organizer.name[i18n.language]}</h1> | ||
<div> | ||
<CopyText text={organizer.id} /> | ||
</div> | ||
{sectionName === "Live" && ( | ||
<div> | ||
<ButtonIcon icon={faPencil} className="text-icon-gray" /> | ||
<ButtonIcon icon={faTrash} className="text-icon-gray" /> | ||
</div> | ||
)} | ||
</div> | ||
</Card> | ||
))} | ||
<div className="grid lg:grid-cols-3"> | ||
{sectionName === "Live" && ( | ||
<ButtonPrimary className="col-span-1"> | ||
{t("details.organizers_info.add")} | ||
</ButtonPrimary> | ||
)} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export const OrganizersInfo = ({ organizers }: Props) => { | ||
const { t } = useTranslation(); | ||
const byStatus = groupBy(organizers, "status"); | ||
|
||
return ( | ||
<> | ||
<Heading level={4} className="font-semibold"> | ||
{t("details.organizers_info.title")} | ||
</Heading> | ||
<p>{t("details.organizers_info.description")}</p> | ||
<OrganizersSection sectionName="Test" organizers={byStatus["Test"]} /> | ||
<OrganizersSection sectionName="Live" organizers={byStatus["Live"]} /> | ||
</> | ||
); | ||
}; |
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,6 @@ | ||
export type Organizer = { | ||
id: string; | ||
name: { [key: string]: string }; | ||
description: string; | ||
status: "Live" | "Test"; | ||
}; |