Skip to content

Commit

Permalink
ui/about: About page doc links and flag names (#2689)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssangervasi authored Feb 24, 2023
1 parent 415f554 commit e1d4302
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Box, FormControl, FormLabel, Switch, Text } from "@fidesui/react";

import { camelToSentenceCase } from "~/features/common/utils";

import { FLAG_CONFIG, FLAG_NAMES } from "./features.slice";
import { FlagValue } from "./types";

Expand Down Expand Up @@ -27,7 +29,9 @@ export const FlagControl = ({
return (
<FormControl display="contents">
<Box>
<FormLabel htmlFor={`flag-${flag}`}>{flag}</FormLabel>
<FormLabel htmlFor={`flag-${flag}`} title={flag}>
{camelToSentenceCase(flag)}
</FormLabel>
</Box>

<Box>
Expand Down
19 changes: 19 additions & 0 deletions clients/admin-ui/src/features/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ import { format } from "date-fns-tz";
export const capitalize = (text: string): string =>
text.replace(/^\w/, (c) => c.toUpperCase());

/**
* "Fun On A Bun" => "Fun on a bun"
* "fun on a bun" => "Fun on a bun"
*/
export const sentenceCase = (text: string) => {
const lower = text.toLocaleLowerCase();
const init = lower.substring(0, 1);
const rest = lower.substring(1);
return `${init.toLocaleUpperCase()}${rest}`;
};

/**
* "funOnABun" => "Fun on a bun"
*/
export const camelToSentenceCase = (text: string) => {
const withSpaces = text.replaceAll(/([a-z])([A-Z])/g, "$1 $2");
return sentenceCase(withSpaces);
};

export const debounce = (fn: Function, ms = 0) => {
let timeoutId: ReturnType<typeof setTimeout>;
// eslint-disable-next-line func-names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useFormikContext } from "formik";
import { ReactNode } from "react";

import { useAppSelector } from "~/app/hooks";
import { sentenceCase } from "~/features/common/utils";
import { initialDataCategories } from "~/features/plus/helpers";
import {
selectDataCategories,
Expand Down Expand Up @@ -133,9 +134,7 @@ const DataFlowsAccordionItem = ({ classifyDataFlows, type }: Props) => {
<AccordionItem p={0} data-testid={`accordion-item-${type}`}>
<AccordionItemContents
headingLevel="h2"
title={`Connected ${
typeLabel[0].toLocaleUpperCase() + typeLabel.slice(1)
} Systems`}
title={`Connected ${sentenceCase(typeLabel)} Systems`}
>
{flows.map((flow, idx) => (
<DataFlowAccordionItem
Expand Down
17 changes: 15 additions & 2 deletions clients/admin-ui/src/pages/management/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,27 @@ const About: NextPage = () => {

<Box>
<Text fontSize="sm">
Please visit docs.ethyca.com for more information on these features.
Please visit{" "}
<Link
color="complimentary.500"
href="https://docs.ethyca.com/fides/overview"
isExternal
>
docs.ethyca.com
</Link>{" "}
for more information on these features.
</Text>

<Text fontSize="sm">
For questions and feedback, please join us at{" "}
<Link href="fidescommunity.slack.com" isExternal>
<Link
color="complimentary.500"
href="https://fidescommunity.slack.com"
isExternal
>
fidescommunity.slack.com
</Link>
.
</Text>
</Box>
</Flex>
Expand Down

0 comments on commit e1d4302

Please sign in to comment.