From 6d8041c3bf3c7ea9679a27e4c8ee70c8340e3af9 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Tue, 1 Oct 2024 13:23:14 +0200 Subject: [PATCH] Stop title-casing hub names --- components/Document/SubmissionDetails.tsx | 3 +-- components/EditorsDashboard/EditorDashboardCard.tsx | 3 +-- components/HubLeaderDashboard/HubLeaderDashboardCard.tsx | 5 +---- components/Hubs/HubTag.tsx | 3 +-- components/Modals/EditHubModal.js | 7 +++---- components/SearchSuggestion/SearchAutosuggest.tsx | 5 ++--- pages/hubs/[slug]/index.js | 4 ++-- pages/hubs/[slug]/live.tsx | 4 ++-- 8 files changed, 13 insertions(+), 21 deletions(-) diff --git a/components/Document/SubmissionDetails.tsx b/components/Document/SubmissionDetails.tsx index a98e4ab5ad..316883ad25 100644 --- a/components/Document/SubmissionDetails.tsx +++ b/components/Document/SubmissionDetails.tsx @@ -4,7 +4,6 @@ import { RHUser } from "~/config/types/root_types"; import AuthorAvatar from "../AuthorAvatar"; import HubDropDown from "../Hubs/HubDropDown"; import { timeSince } from "~/config/utils/dates"; -import { toTitleCase } from "~/config/utils/string"; import { StyleSheet, css } from "aphrodite"; import ALink from "../ALink"; import colors from "~/config/themes/colors"; @@ -97,7 +96,7 @@ function SubmissionDetails({ href={`/hubs/${h.slug}`} overrideStyle={styles.hubLink} > - {" " + toTitleCase(h.name)} + {" " + h.name} {index < visibleHubs?.length - 1 ? "," : ""} diff --git a/components/EditorsDashboard/EditorDashboardCard.tsx b/components/EditorsDashboard/EditorDashboardCard.tsx index fb7cdeb45a..938cff9423 100644 --- a/components/EditorsDashboard/EditorDashboardCard.tsx +++ b/components/EditorsDashboard/EditorDashboardCard.tsx @@ -5,7 +5,6 @@ import { breakpoints } from "~/config/themes/screen"; import { css, StyleSheet } from "aphrodite"; import { ID } from "~/config/types/root_types"; import { timeAgo } from "~/config/utils/dates"; -import { toTitleCase } from "~/config/utils/string"; import AuthorAvatar from "../AuthorAvatar"; import colors from "~/config/themes/colors"; import DesktopOnly from "../DesktopOnly"; @@ -90,7 +89,7 @@ export default function EditorDashboardUserCard({ is_hub_editor_of: isHubEditorOf, } = authorProfile; const hubNameTags = (isHubEditorOf ?? []) - .map((hub: any): string => toTitleCase(hub?.name ?? "")) + .map((hub: any): string => hub?.name ?? "") .map((hubName: string, index: number) => ( -
- {`${toTitleCase(name)}`} -
+
{name}
diff --git a/components/Hubs/HubTag.tsx b/components/Hubs/HubTag.tsx index d4681a23e7..89d173a6e6 100644 --- a/components/Hubs/HubTag.tsx +++ b/components/Hubs/HubTag.tsx @@ -1,4 +1,3 @@ -import { toTitleCase } from "~/config/utils/string"; import Link from "next/link"; import { Hub } from "~/config/types/hub"; import IconButton from "~/components/Icons/IconButton"; @@ -11,7 +10,7 @@ export const HubBadge = ({ name, size }: { name: string; size?: string }) => { variant="round" overrideStyle={[styles.hubBtn, styles[`hubBtn--${size}`]]} > - {toTitleCase(name)} + {name} ); }; diff --git a/components/Modals/EditHubModal.js b/components/Modals/EditHubModal.js index 302628296a..392c44b768 100644 --- a/components/Modals/EditHubModal.js +++ b/components/Modals/EditHubModal.js @@ -14,7 +14,6 @@ import { ModalActions } from "~/redux/modals"; // Config import API from "~/config/api"; -import { toTitleCase } from "~/config/utils/string"; import { Helpers } from "@quantfive/js-web-config"; import colors from "../../config/themes/colors"; import FormTextArea from "../Form/FormTextArea"; @@ -40,8 +39,8 @@ class EditHubModal extends Component { if (prevHub !== currHub) { let hub = this.props.modals.editHubModal.hub; this.setState({ - originalHubName: hub ? toTitleCase(hub.name) : "", - hubName: hub ? toTitleCase(hub.name) : "", + originalHubName: hub ? hub.name : "", + hubName: hub ? hub.name : "", hubDescription: hub ? hub.description : "", }); } @@ -79,7 +78,7 @@ class EditHubModal extends Component { ) { return; } - this.setState({ [id]: id === "hubName" ? toTitleCase(value) : value }); + this.setState({ [id]: value }); }; UpdateHub = async (hub) => { diff --git a/components/SearchSuggestion/SearchAutosuggest.tsx b/components/SearchSuggestion/SearchAutosuggest.tsx index bba2079543..cfea4257dc 100644 --- a/components/SearchSuggestion/SearchAutosuggest.tsx +++ b/components/SearchSuggestion/SearchAutosuggest.tsx @@ -14,7 +14,6 @@ import { PostIcon, PaperIcon, QuestionIcon } from "~/config/themes/icons"; import { CondensedAuthorList } from "../Author/AuthorList"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faGrid2, faNewspaper } from "@fortawesome/pro-solid-svg-icons"; -import { toTitleCase } from "~/config/utils/string"; import { formatNumber } from "~/config/utils/number"; import { highlightTextInSuggestion } from "./lib/util"; import { useEffect, useState } from "react"; @@ -158,7 +157,7 @@ const HubSuggestion = ({ suggestion: HubSuggestionType; searchString?: string; }) => { - const hubName = toTitleCase(suggestion.hub.name); + const hubName = suggestion.hub.name; const titleWithHighlightedPortions = highlightTextInSuggestion( hubName, searchString, @@ -200,7 +199,7 @@ const JournalSuggestion = ({ suggestion: HubSuggestionType; searchString?: string; }) => { - const hubName = toTitleCase(suggestion.hub.name); + const hubName = suggestion.hub.name; const titleWithHighlightedPortions = highlightTextInSuggestion( hubName, searchString, diff --git a/pages/hubs/[slug]/index.js b/pages/hubs/[slug]/index.js index 4d0800bfc0..f170efa6cb 100644 --- a/pages/hubs/[slug]/index.js +++ b/pages/hubs/[slug]/index.js @@ -14,12 +14,12 @@ function Index({ slug, hub, error, isLiveFeed }) { diff --git a/pages/hubs/[slug]/live.tsx b/pages/hubs/[slug]/live.tsx index 63f68d0eb4..774d935764 100644 --- a/pages/hubs/[slug]/live.tsx +++ b/pages/hubs/[slug]/live.tsx @@ -14,12 +14,12 @@ function Index({ slug, hub, error, isLiveFeed }) {