Skip to content

Commit

Permalink
feat: add geocoding preference label (bloom-housing#3765)
Browse files Browse the repository at this point in the history
* feat: add additional fields info to add listing preferences

* feat: add additional fields column to table

* refactor: reuse additional field tag

* refactor: change base tag style

* fix: revert onClose drawer function
  • Loading branch information
KrissDrawing authored and ludtkemorgan committed Jan 23, 2024
1 parent 06a320c commit eeca33b
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const ApplicationForm = ({ listingId, editMode, application }: ApplicationFormPr
<>
<StatusBar>
<Tag
className="tag-uppercase"
variant={application?.status == ApplicationStatus.submitted ? "success" : "primary"}
size={"lg"}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState, useEffect, useMemo, useCallback } from "react"
import { t, MinimalTable, Drawer, Field, StandardTableData } from "@bloom-housing/ui-components"
import { Button, Card, Grid } from "@bloom-housing/ui-seeds"
import { Button, Card, Grid, Tag, Icon } from "@bloom-housing/ui-seeds"
import { useFormContext } from "react-hook-form"
import { ApplicationSection, MultiselectQuestion } from "@bloom-housing/backend-core/types"
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons"
import LinkComponent from "../../../../components/core/LinkComponent"
import SectionWithGrid from "../../../shared/SectionWithGrid"

Expand Down Expand Up @@ -75,10 +76,21 @@ const SelectAndOrder = ({
[draftListingData]
)

const additionalFieldsTag = () => (
<Tag variant="primary">
<Icon icon={faInfoCircle} /> {t("listings.providesAdditionalFields")}
</Tag>
)

const draggableTableData: StandardTableData = useMemo(
() =>
draftListingData.map((item) => ({
name: { content: item.text },
additionalFields: {
content: (
<>{item?.options.some((item) => item.collectAddress) && additionalFieldsTag()}</>
),
},
action: {
content: (
<div className="flex">
Expand All @@ -104,6 +116,11 @@ const SelectAndOrder = ({
listingData.map((item, index) => ({
order: { content: index + 1 },
name: { content: item.text },
additionalFields: {
content: (
<>{item?.options.some((item) => item.collectAddress) && additionalFieldsTag()}</>
),
},
action: {
content: (
<div className="flex">
Expand Down Expand Up @@ -145,11 +162,17 @@ const SelectAndOrder = ({
const formTableHeaders = {
order: "t.order",
name: "t.name",
...(formKey === "preference" && {
additionalFields: "settings.preferenceAdditionalFields",
}),
action: "",
}

const draggableTableHeaders = {
name: "t.name",
...(formKey === "preference" && {
additionalFields: "settings.preferenceAdditionalFields",
}),
action: "",
}

Expand Down Expand Up @@ -188,11 +211,19 @@ const SelectAndOrder = ({
})}
</div>
)}
{option.collectAddress && (
<div className={`${isNotLastItem ? "-mt-4" : "mt-0"}`}>
({t("listings.providesAdditionalFields.info")})
</div>
)}
</div>
)
}
return (
<div className="ml-8 -mt-6 mb-4 text-sm">
{item.options.some((option) => option.collectAddress) && (
<div className="mt-6 mb-2">{additionalFieldsTag()}</div>
)}
<div>
<button
onClick={() => {
Expand Down
30 changes: 25 additions & 5 deletions sites/partners/src/components/listings/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,51 @@ export const getListingStatusTag = (listingStatus: ListingStatus) => {
switch (listingStatus) {
case ListingStatus.active:
return (
<Tag variant={"success"} size={"lg"} id={"listing-status-active"}>
<Tag className="tag-uppercase" variant={"success"} size={"lg"} id={"listing-status-active"}>
{t(`listings.listingStatus.active`)}
</Tag>
)
case ListingStatus.closed:
return (
<Tag variant={"secondary"} size={"lg"} id={"listing-status-closed"}>
<Tag
className="tag-uppercase"
variant={"secondary"}
size={"lg"}
id={"listing-status-closed"}
>
{t(`listings.listingStatus.closed`)}
</Tag>
)
case ListingStatus.pendingReview:
return (
<Tag variant={"in-process"} size={"lg"} id={"listing-status-pending-review"}>
<Tag
className="tag-uppercase"
variant={"in-process"}
size={"lg"}
id={"listing-status-pending-review"}
>
{t(`applications.pendingReview`)}
</Tag>
)
case ListingStatus.changesRequested:
return (
<Tag variant={"highlight-warm"} size={"lg"} id={"listing-status-changes-requested"}>
<Tag
className="tag-uppercase"
variant={"highlight-warm"}
size={"lg"}
id={"listing-status-changes-requested"}
>
{t(`listings.listingStatus.changesRequested`)}
</Tag>
)
default:
return (
<Tag variant={"primary"} size={"lg"} id={"listing-status-pending"}>
<Tag
className="tag-uppercase"
variant={"primary"}
size={"lg"}
id={"listing-status-pending"}
>
{t(`listings.listingStatus.pending`)}
</Tag>
)
Expand Down
5 changes: 4 additions & 1 deletion sites/partners/src/components/users/FormUserManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ const FormUserManage = ({

{mode === "edit" && (
<div className="ml-2 mt-1 flex items-center justify-center">
<Tag variant={user.confirmedAt ? "success" : "primary"}>
<Tag
className="tag-uppercase"
variant={user.confirmedAt ? "success" : "primary"}
>
{user.confirmedAt ? t("users.confirmed") : t("users.unconfirmed")}
</Tag>
</div>
Expand Down
2 changes: 2 additions & 0 deletions sites/partners/src/page_content/locale_overrides/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@
"listings.pdfHelperText": "Select PDF file",
"listings.pickupAddress": "Pickup Address",
"listings.postmarksConsideredQuestion": "Are postmarks considered?",
"listings.providesAdditionalFields": "Provides additional fields",
"listings.providesAdditionalFields.info": "This preference provides additional details that will be included in the exported data",
"listings.publishThisListing": "Publishing will push the listing live on the public site.",
"listings.receivedByDate": "Received by Date",
"listings.receivedByTime": "Received by Time",
Expand Down
6 changes: 3 additions & 3 deletions sites/partners/src/pages/application/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ export default function ApplicationsList() {
switch (application?.status) {
case ApplicationStatus.submitted:
return (
<Tag variant={"success"} size={"lg"}>
<Tag className="tag-uppercase" variant={"success"} size={"lg"}>
{t(`application.details.applicationStatus.submitted`)}
</Tag>
)
case ApplicationStatus.removed:
return (
<Tag variant={"highlight-warm"} size={"lg"}>
<Tag className="tag-uppercase" variant={"highlight-warm"} size={"lg"}>
{t(`application.details.applicationStatus.removed`)}
</Tag>
)
default:
return (
<Tag variant={"primary"} size={"lg"}>
<Tag className="tag-uppercase" variant={"primary"} size={"lg"}>
{t(`application.details.applicationStatus.draft`)}
</Tag>
)
Expand Down
1 change: 1 addition & 0 deletions sites/partners/src/pages/application/[id]/review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const Flag = () => {
}
>
<Tag
className="tag-uppercase"
variant={
data?.status === EnumApplicationFlaggedSetStatus.resolved ? "success" : "primary"
}
Expand Down
2 changes: 1 addition & 1 deletion sites/partners/styles/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--field-value-label-color: var(--seeds-color-alert);
}

.seeds-tag {
.tag-uppercase {
text-transform: uppercase;
letter-spacing: var(--seeds-letter-spacing-wider);
// Allows for status tags to take up the full width of their container
Expand Down

0 comments on commit eeca33b

Please sign in to comment.