From 005b51bddb2b7d3a7e949023e948e0386422a045 Mon Sep 17 00:00:00 2001
From: Patrick Segura <95709965+patrickseguraoddball@users.noreply.github.com>
Date: Mon, 29 Jul 2024 13:14:04 -0500
Subject: [PATCH] [MINT-2208] Homepage refactor (#1245)
* Changed file names, minor refactor
* Fixed route and models favorites props
* Remove feature flag
* Targeted first table in cypress
* Merge in main, resolved conflicts, move HomeTable
* Removed unneeded flag
* Updated snapshots
---
src/i18n/en-US/home.ts | 85 ---
src/i18n/en-US/index.ts | 2 -
src/types/flags.ts | 1 -
src/utils/export/CsvExportLink.tsx | 2 +-
src/utils/user.test.ts | 3 +-
src/views/App/index.tsx | 12 +-
src/views/FlagsWrapper/index.tsx | 3 +-
.../__snapshots__/index.test.tsx.snap | 0
.../{HomeNew => Home}/Settings/index.scss | 0
.../{HomeNew => Home}/Settings/index.test.tsx | 0
.../{HomeNew => Home}/Settings/index.tsx | 0
.../Settings/selectSolutions.tsx | 0
.../{HomeNew => Home}/Settings/settings.tsx | 0
.../Settings/settingsOrder.tsx | 0
.../HomeTable => Home/Table}/index.scss | 0
.../HomeTable => Home/Table}/index.tsx | 63 +-
.../__snapshots__/index.test.tsx.snap | 6 +-
.../__snapshots__/index.test.tsx.snap | 0
.../components/ModelsBySolutions/banner.tsx | 2 +-
.../components/ModelsBySolutions/card.tsx | 0
.../components/ModelsBySolutions/index.scss | 0
.../ModelsBySolutions/index.test.tsx | 0
.../components/ModelsBySolutions/index.tsx | 2 +-
.../components/ModelsBySolutions/table.tsx | 2 +-
src/views/Home/index.scss | 15 +-
src/views/Home/index.test.tsx | 276 ++++---
src/views/Home/index.tsx | 308 ++++++--
src/views/HomeNew/index.scss | 14 -
src/views/HomeNew/index.test.tsx | 227 ------
src/views/HomeNew/index.tsx | 332 ---------
.../ModelPlan/ModelPlanOverview/index.tsx | 11 +-
src/views/ModelPlan/Table/index.scss | 6 -
src/views/ModelPlan/Table/index.tsx | 677 ------------------
33 files changed, 489 insertions(+), 1560 deletions(-)
delete mode 100644 src/i18n/en-US/home.ts
rename src/views/{HomeNew => Home}/Settings/__snapshots__/index.test.tsx.snap (100%)
rename src/views/{HomeNew => Home}/Settings/index.scss (100%)
rename src/views/{HomeNew => Home}/Settings/index.test.tsx (100%)
rename src/views/{HomeNew => Home}/Settings/index.tsx (100%)
rename src/views/{HomeNew => Home}/Settings/selectSolutions.tsx (100%)
rename src/views/{HomeNew => Home}/Settings/settings.tsx (100%)
rename src/views/{HomeNew => Home}/Settings/settingsOrder.tsx (100%)
rename src/views/{ModelPlan/HomeTable => Home/Table}/index.scss (100%)
rename src/views/{ModelPlan/HomeTable => Home/Table}/index.tsx (93%)
rename src/views/{HomeNew => Home}/__snapshots__/index.test.tsx.snap (99%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/__snapshots__/index.test.tsx.snap (100%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/banner.tsx (98%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/card.tsx (100%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/index.scss (100%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/index.test.tsx (100%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/index.tsx (97%)
rename src/views/{HomeNew => Home}/components/ModelsBySolutions/table.tsx (99%)
delete mode 100644 src/views/HomeNew/index.scss
delete mode 100644 src/views/HomeNew/index.test.tsx
delete mode 100644 src/views/HomeNew/index.tsx
delete mode 100644 src/views/ModelPlan/Table/index.scss
delete mode 100644 src/views/ModelPlan/Table/index.tsx
diff --git a/src/i18n/en-US/home.ts b/src/i18n/en-US/home.ts
deleted file mode 100644
index 56e4efc525..0000000000
--- a/src/i18n/en-US/home.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-const home = {
- title: 'Welcome to Model Innovation Tool (MINT)',
- subheading:
- 'The place to collaborate on new CMMI models and demonstrations and access resources to assist with your model plans.',
- macSubheading:
- 'The place to learn about upcoming CMMI models and demonstrations.',
- signIn: 'Sign in to start',
- mintPurpose: 'You can use MINT to:',
- startNow: 'Start a new Model Plan',
- previously: 'previously ',
- viewMore: 'View {{-number}} more',
- viewLess: 'View less',
- more: 'more',
- mintTasks: [
- 'collaborate on requirements for new CMMI models and demonstrations',
- 'access resources to help you complete your model plans'
- ],
- newModelSummaryBox: {
- copy: 'Have a new model or demonstration?',
- cta: 'Start a new Model Plan'
- },
- allModels: {
- copy: 'Don’t see the model you’re looking for?',
- cta: 'View all models',
- heading: 'All models',
- subheading:
- 'Follow models that you want to stay up to date on by clicking the star icon.',
- noResults: {
- heading: 'We couldn’t find any matches for "{{-searchTerm}}".',
- subheading:
- 'Double check your search for typos or try a different search.'
- }
- },
- yourModels: 'You have been added as a team member to the model plans below.',
- fetchError: 'There was an error fetching models plans. Please try again.',
- downloadAllCSV: 'Download all plans as CSV',
- downloadSingleCSV: 'Download this Model Plan (CSV)',
- requestsTable: {
- id: 'model-plans',
- title: 'Model plans',
- basic: {
- heading: 'My model plans'
- },
- admin: {
- heading: 'All model plans'
- },
- mac: {
- heading: 'Upcoming models',
- empty: {
- heading: 'There aren’t any model plans with CRs or TDLs.',
- body:
- 'Check back later. When CR or TDL is added to a model plan, it will appear here.'
- }
- },
- empty: {
- heading: 'You haven’t been added to any Model Plans yet.',
- body:
- 'Once you create one or are added as a team member to an existing plan, it will appear here.'
- },
- caption:
- 'Below is a list of governance requests that are in draft or submitted.',
- headers: {
- name: 'Model name',
- category: 'Category',
- abbreviation: 'Short name',
- amsModelID: 'ID',
- modelPoc: 'Model lead(s)',
- clearanceDate: 'Anticipated clearance date',
- startDate: 'Model start date',
- paymentDate: 'Payment start date',
- keyCharacteristics: 'Key characteristics',
- demoCode: 'Demo code',
- crTDLs: 'CRs and TDLs',
- status: 'Status',
- recentActivity: 'Recent activity'
- },
- noneSelectedYet: 'None selected yet',
- tbd: 'To be determined',
- updated: 'Updated',
- unansweredQuestion: 'unanswered question',
- answeredQuestion: 'answered question'
- }
-};
-
-export default home;
diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts
index dcf50d6ac1..3623a8ddd2 100644
--- a/src/i18n/en-US/index.ts
+++ b/src/i18n/en-US/index.ts
@@ -53,7 +53,6 @@ import feedback from './feedback';
import footer from './footer';
import general from './general';
import header from './header';
-import home from './home';
import landing from './landing';
import plan from './modelPlan';
import modelPlanTaskList from './modelPlanTaskList';
@@ -77,7 +76,6 @@ const enUS = {
getAccess,
header,
helpAndKnowledge,
- home,
homepageSettings,
landing,
plan,
diff --git a/src/types/flags.ts b/src/types/flags.ts
index 32e9936c25..5f2970de8d 100644
--- a/src/types/flags.ts
+++ b/src/types/flags.ts
@@ -5,7 +5,6 @@ export type Flags = {
helpScoutEnabled: boolean;
feedbackEnabled: boolean;
notificationsEnabled: boolean;
- customHomepageEnabled: boolean;
};
export type FlagsState = {
diff --git a/src/utils/export/CsvExportLink.tsx b/src/utils/export/CsvExportLink.tsx
index f85480eff1..4209de91f3 100644
--- a/src/utils/export/CsvExportLink.tsx
+++ b/src/utils/export/CsvExportLink.tsx
@@ -11,7 +11,7 @@ type CsvExportLinkType = {
export const CsvExportLink = ({
modelPlanID
}: CsvExportLinkType): React.ReactElement => {
- const { t } = useTranslation('home');
+ const { t } = useTranslation('customHome');
const { fetchSingleData, fetchAllData } = useFetchCSVData();
diff --git a/src/utils/user.test.ts b/src/utils/user.test.ts
index 52a4aaa0b0..885af022de 100644
--- a/src/utils/user.test.ts
+++ b/src/utils/user.test.ts
@@ -44,8 +44,7 @@ describe('user', () => {
hideGroupView: true,
helpScoutEnabled: false,
feedbackEnabled: false,
- notificationsEnabled: false,
- customHomepageEnabled: false
+ notificationsEnabled: false
})
).toBe(false);
});
diff --git a/src/views/App/index.tsx b/src/views/App/index.tsx
index 26111f0641..e063f7a3c7 100644
--- a/src/views/App/index.tsx
+++ b/src/views/App/index.tsx
@@ -26,8 +26,7 @@ import FlagsWrapper from 'views/FlagsWrapper';
import HelpAndKnowledge from 'views/HelpAndKnowledge';
import GetAccess from 'views/HelpAndKnowledge/Articles/GetAccess';
import Home from 'views/Home';
-import HomeNew from 'views/HomeNew';
-import HomePageSettings from 'views/HomeNew/Settings';
+import HomePageSettings from 'views/Home/Settings';
import Landing from 'views/Landing';
import Login from 'views/Login';
import ModelAccessWrapper from 'views/ModelAccessWrapper';
@@ -117,18 +116,11 @@ const AppRoutes = () => {
if (!authState?.isAuthenticated) {
return ;
}
- if (flags.customHomepageEnabled) {
- return ;
- }
return ;
}}
/>
-
+
diff --git a/src/views/FlagsWrapper/index.tsx b/src/views/FlagsWrapper/index.tsx
index 2ce36cf2fe..3408228f0c 100644
--- a/src/views/FlagsWrapper/index.tsx
+++ b/src/views/FlagsWrapper/index.tsx
@@ -42,8 +42,7 @@ const UserTargetingWrapper = ({ children }: WrapperProps) => {
helpScoutEnabled: false,
feedbackEnabled: false,
downgradeNonCMS: false,
- notificationsEnabled: false,
- customHomepageEnabled: false
+ notificationsEnabled: false
}
});
diff --git a/src/views/HomeNew/Settings/__snapshots__/index.test.tsx.snap b/src/views/Home/Settings/__snapshots__/index.test.tsx.snap
similarity index 100%
rename from src/views/HomeNew/Settings/__snapshots__/index.test.tsx.snap
rename to src/views/Home/Settings/__snapshots__/index.test.tsx.snap
diff --git a/src/views/HomeNew/Settings/index.scss b/src/views/Home/Settings/index.scss
similarity index 100%
rename from src/views/HomeNew/Settings/index.scss
rename to src/views/Home/Settings/index.scss
diff --git a/src/views/HomeNew/Settings/index.test.tsx b/src/views/Home/Settings/index.test.tsx
similarity index 100%
rename from src/views/HomeNew/Settings/index.test.tsx
rename to src/views/Home/Settings/index.test.tsx
diff --git a/src/views/HomeNew/Settings/index.tsx b/src/views/Home/Settings/index.tsx
similarity index 100%
rename from src/views/HomeNew/Settings/index.tsx
rename to src/views/Home/Settings/index.tsx
diff --git a/src/views/HomeNew/Settings/selectSolutions.tsx b/src/views/Home/Settings/selectSolutions.tsx
similarity index 100%
rename from src/views/HomeNew/Settings/selectSolutions.tsx
rename to src/views/Home/Settings/selectSolutions.tsx
diff --git a/src/views/HomeNew/Settings/settings.tsx b/src/views/Home/Settings/settings.tsx
similarity index 100%
rename from src/views/HomeNew/Settings/settings.tsx
rename to src/views/Home/Settings/settings.tsx
diff --git a/src/views/HomeNew/Settings/settingsOrder.tsx b/src/views/Home/Settings/settingsOrder.tsx
similarity index 100%
rename from src/views/HomeNew/Settings/settingsOrder.tsx
rename to src/views/Home/Settings/settingsOrder.tsx
diff --git a/src/views/ModelPlan/HomeTable/index.scss b/src/views/Home/Table/index.scss
similarity index 100%
rename from src/views/ModelPlan/HomeTable/index.scss
rename to src/views/Home/Table/index.scss
diff --git a/src/views/ModelPlan/HomeTable/index.tsx b/src/views/Home/Table/index.tsx
similarity index 93%
rename from src/views/ModelPlan/HomeTable/index.tsx
rename to src/views/Home/Table/index.tsx
index 7f94867edd..30ea7417a1 100644
--- a/src/views/ModelPlan/HomeTable/index.tsx
+++ b/src/views/Home/Table/index.tsx
@@ -51,25 +51,15 @@ type CRTDLType =
| GetCrtdLsQuery['modelPlan']['crs'][0]
| GetCrtdLsQuery['modelPlan']['tdls'][0];
-type ModelPlansTableProps =
- | {
- id: string;
- type: ViewCustomizationType;
- updateFavorite?: never;
- hiddenColumns?: number[]; // indexes of columns to be hidden
- canSearch?: boolean;
- isHome?: boolean;
- isAssessment?: boolean;
- }
- | {
- id: string;
- type: ViewCustomizationType.FOLLOWED_MODELS;
- updateFavorite: (modelPlanID: string, type: UpdateFavoriteProps) => void;
- hiddenColumns?: number[]; // indexes of columns to be hidden
- canSearch?: boolean;
- isHome?: boolean;
- isAssessment?: boolean;
- };
+type ModelPlansTableProps = {
+ id: string;
+ type: ViewCustomizationType;
+ updateFavorite?: (modelPlanID: string, type: UpdateFavoriteProps) => void;
+ hiddenColumns?: number[]; // indexes of columns to be hidden
+ canSearch?: boolean;
+ isHome?: boolean;
+ isAssessment?: boolean;
+};
const ModelPlansTable = ({
id,
@@ -122,7 +112,10 @@ const ModelPlansTable = ({
const tableColumns: Record = {
[ViewCustomizationType.MY_MODEL_PLANS]: [...homeColumns],
- [ViewCustomizationType.ALL_MODEL_PLANS]: [...homeColumns],
+ [ViewCustomizationType.ALL_MODEL_PLANS]: [
+ ...(!isHome ? ['isFavorite'] : []),
+ ...homeColumns
+ ],
[ViewCustomizationType.FOLLOWED_MODELS]: ['isFavorite', ...homeColumns],
[ViewCustomizationType.MODELS_WITH_CR_TDL]: [
'modelName',
@@ -337,8 +330,12 @@ const ModelPlansTable = ({
if (value) {
return value
.map(characteristics => {
- return i18next.t(
- `generalCharacteristics:keyCharacteristics.options.${characteristics}`
+ return (
+
+ {i18next.t(
+ `generalCharacteristics:keyCharacteristics.options.${characteristics}`
+ )}
+
);
})
.join(', ');
@@ -363,7 +360,7 @@ const ModelPlansTable = ({
return (
{value.map((crtdl: CRTDLType) => (
- - {crtdl.idNumber}
+ - {crtdl.idNumber}
))}
);
@@ -476,15 +473,9 @@ const ModelPlansTable = ({
const modelsStyle = (index: number) => {
return {
minWidth:
- (type === ViewCustomizationType.FOLLOWED_MODELS &&
- index === 0 &&
- '50px') ||
- (type === ViewCustomizationType.FOLLOWED_MODELS &&
- index === 2 &&
- '100px') ||
- (type === ViewCustomizationType.FOLLOWED_MODELS &&
- index === 3 &&
- '100px') ||
+ (!isHome && index === 0 && '50px') ||
+ (!isHome && index === 2 && '100px') ||
+ (!isHome && index === 3 && '100px') ||
'138px',
padding: index === 0 ? '0' : 'auto',
paddingTop: index === 0 ? '0rem' : 'auto',
@@ -542,11 +533,7 @@ const ModelPlansTable = ({
aria-sort={getColumnSortStatus(column)}
className="table-header"
scope="col"
- style={
- type === ViewCustomizationType.FOLLOWED_MODELS
- ? modelsStyle(index)
- : homeStyle(index)
- }
+ style={!isHome ? modelsStyle(index) : homeStyle(index)}
>
-
+