From 2755c1cd62718cddbebadfecfd3b3c1ac724c6fc Mon Sep 17 00:00:00 2001 From: Chintan Mehta <22376522+chinmehta@users.noreply.github.com> Date: Thu, 23 Nov 2023 11:38:55 +0000 Subject: [PATCH] [Platform]: Homepage crash sharing parameter by value (#298) --- apps/platform/src/App.tsx | 43 ++++++++++--------- apps/platform/src/pages/HomePage/HomePage.jsx | 3 +- .../src/pages/HomePage/PPHomePage.jsx | 3 +- apps/platform/src/pages/HomePage/index.jsx | 12 +++--- apps/platform/src/utils/global.js | 2 +- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/apps/platform/src/App.tsx b/apps/platform/src/App.tsx index 0520c23e7..16baf4eee 100644 --- a/apps/platform/src/App.tsx +++ b/apps/platform/src/App.tsx @@ -1,37 +1,38 @@ -import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; -import { ApolloProvider } from '@apollo/client'; -import { ThemeProvider, SearchProvider, PrivateRoute } from 'ui'; +import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; +import { ApolloProvider } from "@apollo/client"; +import { ThemeProvider, SearchProvider, PrivateRoute } from "ui"; -import SEARCH_QUERY from './components/Search/SearchQuery.gql'; -import ShouldAccessPPP from './components/ShouldAccessPPP'; -import client from './client'; -import theme from './theme'; -import HomePage from './pages/HomePage'; -import SearchPage from './pages/SearchPage'; -import DiseasePage from './pages/DiseasePage'; -import DownloadsPage from './pages/DownloadsPage'; -import DrugPage from './pages/DrugPage'; -import TargetPage from './pages/TargetPage'; -import EvidencePage from './pages/EvidencePage'; -import VariantsPage from './pages/VariantsPage'; -import APIPage from './pages/APIPage'; -import NotFoundPage from './pages/NotFoundPage'; -import ProjectsPage from './pages/ProjectsPage'; -import { getSuggestedSearch } from './utils/global'; +import SEARCH_QUERY from "./components/Search/SearchQuery.gql"; +import ShouldAccessPPP from "./components/ShouldAccessPPP"; +import client from "./client"; +import theme from "./theme"; +import HomePage from "./pages/HomePage"; +import SearchPage from "./pages/SearchPage"; +import DiseasePage from "./pages/DiseasePage"; +import DownloadsPage from "./pages/DownloadsPage"; +import DrugPage from "./pages/DrugPage"; +import TargetPage from "./pages/TargetPage"; +import EvidencePage from "./pages/EvidencePage"; +import VariantsPage from "./pages/VariantsPage"; +import APIPage from "./pages/APIPage"; +import NotFoundPage from "./pages/NotFoundPage"; +import ProjectsPage from "./pages/ProjectsPage"; +import { getSuggestedSearch } from "./utils/global"; function App() { + const suggestions = getSuggestedSearch(); return ( - + diff --git a/apps/platform/src/pages/HomePage/HomePage.jsx b/apps/platform/src/pages/HomePage/HomePage.jsx index d839c70a0..438575d24 100644 --- a/apps/platform/src/pages/HomePage/HomePage.jsx +++ b/apps/platform/src/pages/HomePage/HomePage.jsx @@ -93,9 +93,8 @@ function HelpBoxPanel({ fai, url, label, external }) { ); } -function HomePage() { +function HomePage({ suggestions }) { const classes = useStyles(); - const suggestions = getSuggestedSearch(); const handleScrollDown = () => { window.scrollTo({ top: window.innerHeight, left: 0, behavior: "smooth" }); diff --git a/apps/platform/src/pages/HomePage/PPHomePage.jsx b/apps/platform/src/pages/HomePage/PPHomePage.jsx index 87106aed2..943b6e3d0 100644 --- a/apps/platform/src/pages/HomePage/PPHomePage.jsx +++ b/apps/platform/src/pages/HomePage/PPHomePage.jsx @@ -93,9 +93,8 @@ function HelpBoxPanel({ fai, url, label, external }) { ); } -function HomePage() { +function HomePage({ suggestions }) { const classes = useStyles(); - const suggestions = getSuggestedSearch(); const handleScrollDown = () => { window.scrollTo({ top: window.innerHeight, left: 0, behavior: "smooth" }); diff --git a/apps/platform/src/pages/HomePage/index.jsx b/apps/platform/src/pages/HomePage/index.jsx index 7e1bded42..7c531415e 100644 --- a/apps/platform/src/pages/HomePage/index.jsx +++ b/apps/platform/src/pages/HomePage/index.jsx @@ -1,11 +1,11 @@ -import PublicHome from './HomePage'; -import PPHome from './PPHomePage'; -import { usePermissions } from 'ui'; +import PublicHome from "./HomePage"; +import PPHome from "./PPHomePage"; +import { usePermissions } from "ui"; -function GetHomePage() { +function GetHomePage({ suggestions }) { const { isPartnerPreview } = usePermissions(); - if (isPartnerPreview) return ; - return ; + if (isPartnerPreview) return ; + return ; } export default GetHomePage; diff --git a/apps/platform/src/utils/global.js b/apps/platform/src/utils/global.js index ff0e52d77..b1550d45a 100644 --- a/apps/platform/src/utils/global.js +++ b/apps/platform/src/utils/global.js @@ -2,7 +2,7 @@ import { format } from "d3-format"; import config from "../config"; import { searchExamples, pppSearchExamples } from "../pages/HomePage/searchExamples"; -function pickTwo(arr) { +function pickTwo([...arr]) { const i1 = Math.floor(Math.random() * arr.length); const resultArray = arr.splice(i1, 1); const i2 = Math.floor(Math.random() * arr.length);