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

configure feedback URL per tenant #447

Merged
merged 1 commit into from
Jun 4, 2021
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
11 changes: 7 additions & 4 deletions spotlight-client/src/SiteNavigation/SiteNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
NavGroupItem,
NavLink,
ExternalNavLink,
FEEDBACK_URL,
NavButton,
ShareButtonProps,
} from "./shared";
Expand Down Expand Up @@ -121,9 +120,13 @@ const SiteNavigation: React.FC<ShareButtonProps> = ({ openShareModal }) => {
/>
</NavGroupItem>
)}
<NavGroupItem>
<ExternalNavLink href={FEEDBACK_URL}>Feedback</ExternalNavLink>
</NavGroupItem>
{tenant && (
<NavGroupItem>
<ExternalNavLink href={tenant.feedbackUrl}>
Feedback
</ExternalNavLink>
</NavGroupItem>
)}
<NavGroupItem>
<NavButton onClick={openShareModal}>Share</NavButton>
</NavGroupItem>
Expand Down
11 changes: 7 additions & 4 deletions spotlight-client/src/SiteNavigation/SiteNavigationMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
NavGroup,
NavGroupItem as NavGroupItemBase,
NavLink as NavLinkBase,
FEEDBACK_URL,
ExternalNavLink as ExternalNavLinkBase,
NavButton as ExternalNavButton,
ShareButtonProps,
Expand Down Expand Up @@ -203,9 +202,13 @@ const SiteNavigation: React.FC<ShareButtonProps> = ({ openShareModal }) => {
</NavLink>
</NavMenuItem>
)}
<NavMenuItem>
<ExternalNavLink href={FEEDBACK_URL}>Feedback</ExternalNavLink>
</NavMenuItem>
{tenant && (
<NavMenuItem>
<ExternalNavLink href={tenant.feedbackUrl}>
Feedback
</ExternalNavLink>
</NavMenuItem>
)}
<NavMenuItem>
<NavButton
onClick={() => {
Expand Down
3 changes: 0 additions & 3 deletions spotlight-client/src/SiteNavigation/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ export const NavButton = styled(UnStyledButton)`
${linkStyles}
`;

export const FEEDBACK_URL =
"https://docs.google.com/forms/d/e/1FAIpQLSc3_wV2ltGumMdGTcLehUM41tQri0ZW5RjIKh0JJlhpJGE9Hg/viewform";

export type ShareButtonProps = {
openShareModal: () => void;
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const content: TenantContent = {
name: "Test Tenant",
description: "test tenant description",
coBrandingCopy: "test tenant co-branding",
feedbackUrl: "https://example.com/feedback",
metrics: {
SentencePopulationCurrent: {
name: "test SentencePopulationCurrent name",
Expand Down
2 changes: 2 additions & 0 deletions spotlight-client/src/contentApi/sources/us_nd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const content: TenantContent = {
'<a href="https://www.docr.nd.gov">The North Dakota Department of Corrections and Rehabilitation (DOCR)</a> provides correctional services for the state of North Dakota. Our mission is to transform lives, influence change, and strengthen community. Transparency is a critical element of our mission; sharing information builds greater accountability between the DOCR and the communities we serve.',
coBrandingCopy:
'Produced in collaboration with <a href="https://www.docr.nd.gov">the North Dakota Department of Corrections and Rehabilitation</a>.',
feedbackUrl:
"https://docs.google.com/forms/d/e/1FAIpQLSc3_wV2ltGumMdGTcLehUM41tQri0ZW5RjIKh0JJlhpJGE9Hg/viewform",
demographicCategories: {
raceOrEthnicity: [
"AMERICAN_INDIAN_ALASKAN_NATIVE",
Expand Down
1 change: 1 addition & 0 deletions spotlight-client/src/contentApi/sources/us_pa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const content: TenantContent = {
description: "",
coBrandingCopy:
'Produced in collaboration with <a href="https://www.cor.pa.gov">the Pennsylvania Department of Corrections</a>.',
feedbackUrl: "https://forms.gle/7bZMpgGR69uaW1eNA",
demographicCategories: {
raceOrEthnicity: [
"BLACK",
Expand Down
1 change: 1 addition & 0 deletions spotlight-client/src/contentApi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type TenantContent = {
name: string;
description: string;
coBrandingCopy: string;
feedbackUrl: string;
metrics: {
[key in Extract<
MetricTypeId,
Expand Down
2 changes: 2 additions & 0 deletions spotlight-client/src/contentModels/Tenant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ test.each([
const tenant = createTenant({ tenantId: "US_ND" });
expect(tenant.name).toBe(fixture.name);
expect(tenant.description).toBe(fixture.description);
expect(tenant.coBrandingCopy).toBe(fixture.coBrandingCopy);
expect(tenant.feedbackUrl).toBe(fixture.feedbackUrl);
});

test.each([
Expand Down
6 changes: 6 additions & 0 deletions spotlight-client/src/contentModels/Tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type InitOptions = {
name: string;
description: string;
coBrandingCopy: string;
feedbackUrl: string;
metrics: MetricMapping;
systemNarratives: SystemNarrativeMapping;
racialDisparitiesNarrative?: RacialDisparitiesNarrative;
Expand All @@ -48,6 +49,8 @@ export default class Tenant {

readonly coBrandingCopy: string;

readonly feedbackUrl: string;

readonly metrics: InitOptions["metrics"];

readonly systemNarratives: SystemNarrativeMapping;
Expand All @@ -59,6 +62,7 @@ export default class Tenant {
name,
description,
coBrandingCopy,
feedbackUrl,
metrics,
systemNarratives,
racialDisparitiesNarrative,
Expand All @@ -67,6 +71,7 @@ export default class Tenant {
this.name = name;
this.description = description;
this.coBrandingCopy = coBrandingCopy;
this.feedbackUrl = feedbackUrl;
this.metrics = metrics;
this.systemNarratives = systemNarratives;
this.racialDisparitiesNarrative = racialDisparitiesNarrative;
Expand Down Expand Up @@ -131,6 +136,7 @@ export function createTenant({ tenantId }: TenantFactoryOptions): Tenant {
name: allTenantContent.name,
description: allTenantContent.description,
coBrandingCopy: allTenantContent.coBrandingCopy,
feedbackUrl: allTenantContent.feedbackUrl,
metrics,
systemNarratives: getSystemNarrativesForTenant({
allTenantContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const content: ExhaustiveTenantContent = {
name: "Test Tenant",
description: "test tenant description",
coBrandingCopy: "test tenant co-branding",
feedbackUrl: "https://example.com/feedback",
// tests are based on ND data which has this demo profile
demographicCategories: {
raceOrEthnicity: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const content: TenantContent = {
name: "Test Tenant",
description: "test tenant description",
coBrandingCopy: "test tenant co-branding",
feedbackUrl: "https://example.com/feedback",
// this is an intentionally non-exhaustive set of metrics
metrics: {
SentencePopulationCurrent: {
Expand Down