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

Header titles added #2042

Merged
merged 23 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
110 changes: 57 additions & 53 deletions packages/files-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { BillingProvider } from "./Contexts/BillingContext"
import { PosthogProvider } from "./Contexts/PosthogContext"
import { NotificationsProvider } from "./Contexts/NotificationsContext"
import { StylesProvider, createGenerateClassName } from "@material-ui/styles"
import { HelmetProvider } from "react-helmet-async"

import ErrorModal from "./Components/Modules/ErrorModal"

// making material and jss use one className generator
Expand Down Expand Up @@ -79,63 +81,65 @@ const App = () => {
const directAuthNetwork = (process.env.REACT_APP_DIRECT_AUTH_NETWORK === "mainnet") ? "mainnet" : "testnet"

return (
<StylesProvider generateClassName={generateClassName}>
<ThemeSwitcher
storageKey="csf.themeKey"
themes={{ light: lightTheme, dark: darkTheme }}
>
<ErrorBoundary
fallback={ErrorModal}
onReset={() => window.location.reload()}
<HelmetProvider>
<StylesProvider generateClassName={generateClassName}>
<ThemeSwitcher
storageKey="csf.themeKey"
themes={{ light: lightTheme, dark: darkTheme }}
>
<CssBaseline />
<LanguageProvider availableLanguages={availableLanguages}>
<ToastProvider
autoDismiss
defaultPosition="bottomRight"
>
<Web3Provider
onboardConfig={onboardConfig}
checkNetwork={false}
cacheWalletSelection={canUseLocalStorage}
tokensToWatch={{
1: [
{ address: "0x6b175474e89094c44da98b954eedeac495271d0f" },
{ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }
]
}}
<ErrorBoundary
fallback={ErrorModal}
onReset={() => window.location.reload()}
>
<CssBaseline />
<LanguageProvider availableLanguages={availableLanguages}>
<ToastProvider
autoDismiss
defaultPosition="bottomRight"
>
<FilesApiProvider
apiUrl={apiUrl}
withLocalStorage={false}
<Web3Provider
onboardConfig={onboardConfig}
checkNetwork={false}
cacheWalletSelection={canUseLocalStorage}
tokensToWatch={{
1: [
{ address: "0x6b175474e89094c44da98b954eedeac495271d0f" },
{ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }
]
}}
>
<ThresholdKeyProvider
enableLogging={directAuthNetwork !== "mainnet"}
network={directAuthNetwork}
<FilesApiProvider
apiUrl={apiUrl}
withLocalStorage={false}
>
<Router>
<NotificationsProvider>
<UserProvider>
<FilesProvider>
<BillingProvider>
<PosthogProvider>
<AppWrapper>
<FilesRoutes />
</AppWrapper>
</PosthogProvider>
</BillingProvider>
</FilesProvider>
</UserProvider>
</NotificationsProvider>
</Router>
</ThresholdKeyProvider>
</FilesApiProvider>
</Web3Provider>
</ToastProvider>
</LanguageProvider>
</ErrorBoundary>
</ThemeSwitcher>
</StylesProvider>
<ThresholdKeyProvider
enableLogging={directAuthNetwork !== "mainnet"}
network={directAuthNetwork}
>
<Router>
<NotificationsProvider>
<UserProvider>
<FilesProvider>
<BillingProvider>
<PosthogProvider>
<AppWrapper>
<FilesRoutes />
</AppWrapper>
</PosthogProvider>
</BillingProvider>
</FilesProvider>
</UserProvider>
</NotificationsProvider>
</Router>
</ThresholdKeyProvider>
</FilesApiProvider>
</Web3Provider>
</ToastProvider>
</LanguageProvider>
</ErrorBoundary>
</ThemeSwitcher>
</StylesProvider>
</HelmetProvider>
)
}

Expand Down
8 changes: 4 additions & 4 deletions packages/files-ui/src/Components/FilesRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { useFilesApi } from "../Contexts/FilesApiContext"
import DrivePage from "./Pages/DrivePage"
import SearchPage from "./Pages/SearchPage"
import BinPage from "./Pages/BinPage"
import { useThresholdKey } from "../Contexts/ThresholdKeyContext"
import ShareFilesPage from "./Pages/SharedFilesPage"
import SharedFoldersOverview from "./Modules/FileBrowsers/SharedFoldersOverview"
import SharedFoldersPage from "./Pages/SharedFoldersPage"
import BillingHistory from "./Pages/BillingHistory"
import { NonceResponsePermission } from "@chainsafe/files-api-client"
import LinkSharingLanding from "./Pages/LinkSharingLanding"
import { NonceResponsePermission } from "@chainsafe/files-api-client"
import { useThresholdKey } from "../Contexts/ThresholdKeyContext"

export const SETTINGS_BASE = "/settings"
export const LINK_SHARING_BASE = "/link-sharing"
Expand Down Expand Up @@ -76,7 +76,7 @@ const FilesRoutes = () => {
exact
path={ROUTE_LINKS.SharedFolders}
isAuthorized={isAuthorized}
component={SharedFoldersOverview}
component={SharedFoldersPage}
redirectPath={ROUTE_LINKS.Landing}
/>
<ConditionalRoute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { DISMISSED_SURVEY_KEY } from "../../SurveyBanner"
import { FileBrowserContext } from "../../../Contexts/FileBrowserContext"
import { parseFileContentResponse } from "../../../Utils/Helpers"
import getFilesFromDataTransferItems from "../../../Utils/getFilesFromDataTransferItems"
import { Helmet } from "react-helmet-async"

const CSFFileBrowser: React.FC<IFileBrowserModuleProps> = () => {
const { downloadFile, uploadFiles, buckets } = useFiles()
Expand Down Expand Up @@ -116,7 +117,6 @@ const CSFFileBrowser: React.FC<IFileBrowserModuleProps> = () => {
const moveItems = useCallback(async (cids: string[], newPath: string) => {
if (!bucket) return


const pathsToMove = getAbsolutePathsFromCids(cids, currentPath, pathContents)

filesApiClient.moveBucketObjects(bucket.id, {
Expand Down Expand Up @@ -157,6 +157,10 @@ const CSFFileBrowser: React.FC<IFileBrowserModuleProps> = () => {
path: joinArrayOfPaths(arrayOfPaths.slice(0, index + 1))
}}), [arrayOfPaths, redirect])

const currentFolder = useMemo(() => {
return arrayOfPaths[arrayOfPaths.length - 1]
}, [arrayOfPaths])

const handleUploadOnDrop = useCallback(async (files: File[], fileItems: DataTransferItemList, path: string) => {
if (!bucket) return

Expand Down Expand Up @@ -222,6 +226,11 @@ const CSFFileBrowser: React.FC<IFileBrowserModuleProps> = () => {
itemOperations,
withSurvey: showSurvey && olderThanOneWeek
}}>
{!!currentFolder &&
<Helmet>
<title>{currentFolder} - Chainsafe Files</title>
</Helmet>
}
<DragAndDrop>
<FilesList />
</DragAndDrop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import FilesList from "./views/FilesList"
import { createStyles, makeStyles } from "@chainsafe/common-theme"
import { CSFTheme } from "../../../Themes/types"
import getFilesFromDataTransferItems from "../../../Utils/getFilesFromDataTransferItems"
import { Helmet } from "react-helmet-async"

const useStyles = makeStyles(({ constants, palette }: CSFTheme) =>
createStyles({
Expand Down Expand Up @@ -87,6 +88,9 @@ const SharedFileBrowser = () => {
}
})
}), [arrayOfPaths, bucket, redirect])
const currentFolder = useMemo(() => {
return arrayOfPaths[arrayOfPaths.length - 1]
tanmoyAtb marked this conversation as resolved.
Show resolved Hide resolved
}, [arrayOfPaths])

const refreshContents = useCallback((showLoading?: boolean) => {
if (!bucket) return
Expand Down Expand Up @@ -308,6 +312,11 @@ const SharedFileBrowser = () => {
itemOperations,
withSurvey: false
}}>
{(!!currentFolder || bucket.name) &&
<Helmet>
<title>{currentFolder || bucket.name} - Chainsafe Files</title>
</Helmet>
}
<DragAndDrop>
<FilesList isShared/>
</DragAndDrop>
Expand Down
34 changes: 20 additions & 14 deletions packages/files-ui/src/Components/Pages/BillingHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Typography } from "@chainsafe/common-components"
import { Trans } from "@lingui/macro"
import InvoiceLines from "../Elements/InvoiceLines"
import PayInvoiceModal from "../Modules/Settings/SubscriptionTab/PayInvoice/PayInvoiceModal"
import { Helmet } from "react-helmet-async"

const useStyles = makeStyles(
({ constants, breakpoints }: CSFTheme) =>
Expand Down Expand Up @@ -34,20 +35,25 @@ const BillingHistory = () => {
const [invoiceToPay, setInvoiceToPay] = useState<string | undefined>()

return (
<div className={classes.root}>
<Typography
className={classes.heading}
variant="h1"
component="p"
>
<Trans>Billing history</Trans>
</Typography>
<InvoiceLines payInvoice={(invoiceId) => setInvoiceToPay(invoiceId)} />
{invoiceToPay && <PayInvoiceModal
invoiceId={invoiceToPay}
onClose={() => setInvoiceToPay(undefined)}
/>}
</div>
<>
<Helmet>
<title>Billing history - Chainsafe Files</title>
tanmoyAtb marked this conversation as resolved.
Show resolved Hide resolved
</Helmet>
<div className={classes.root}>
<Typography
className={classes.heading}
variant="h1"
component="p"
>
<Trans>Billing history</Trans>
</Typography>
<InvoiceLines payInvoice={(invoiceId) => setInvoiceToPay(invoiceId)} />
{invoiceToPay && <PayInvoiceModal
invoiceId={invoiceToPay}
onClose={() => setInvoiceToPay(undefined)}
/>}
</div>
</>
)
}

Expand Down
8 changes: 7 additions & 1 deletion packages/files-ui/src/Components/Pages/BinPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import BinFileBrowser from "../Modules/FileBrowsers/BinFileBrowser"
import { Helmet } from "react-helmet-async"

const BinPage = () => {
usePageTrack()

return <BinFileBrowser />
return <>
<Helmet>
<title>Bin - Chainsafe Files</title>
tanmoyAtb marked this conversation as resolved.
Show resolved Hide resolved
</Helmet>
<BinFileBrowser />
</>
}

export default BinPage
8 changes: 7 additions & 1 deletion packages/files-ui/src/Components/Pages/DrivePage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import CSFFileBrowser from "../Modules/FileBrowsers/CSFFileBrowser"
import { Helmet } from "react-helmet-async"

const DrivePage = () => {
usePageTrack()

return <CSFFileBrowser />
return <>
<Helmet>
<title>Home - Chainsafe Files</title>
</Helmet>
<CSFFileBrowser />
</>
}

export default DrivePage
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import LinkSharingModule from "../Modules/LinkSharingModule"
import { Helmet } from "react-helmet-async"

const LinkSharingLanding = () => {
usePageTrack()

return <LinkSharingModule/>
return <>
<Helmet>
<title>Shared link - Chainsafe Files</title>
</Helmet>
<LinkSharingModule/>
</>
}

export default LinkSharingLanding
8 changes: 7 additions & 1 deletion packages/files-ui/src/Components/Pages/SearchPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import SearchFileBrowser from "../Modules/FileBrowsers/SearchFileBrowser"
import { Helmet } from "react-helmet-async"

const SearchPage = () => {
usePageTrack()

return <SearchFileBrowser />
return <>
<Helmet>
<title>Search results - Chainsafe Files</title>
</Helmet>
<SearchFileBrowser />
</>
}

export default SearchPage
8 changes: 7 additions & 1 deletion packages/files-ui/src/Components/Pages/SettingsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import Settings from "../Modules/Settings"
import { Helmet } from "react-helmet-async"

const SettingsPage = () => {
usePageTrack()

return <Settings />
return <>
<Helmet>
<title>Settings - Chainsafe Files</title>
</Helmet>
<Settings />
</>
}

export default SettingsPage
17 changes: 17 additions & 0 deletions packages/files-ui/src/Components/Pages/SharedFoldersPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react"
import { usePageTrack } from "../../Contexts/PosthogContext"
import SharedFoldersOverview from "../Modules/FileBrowsers/SharedFoldersOverview"
import { Helmet } from "react-helmet-async"

const SharedFoldersPage = () => {
usePageTrack()

return <>
<Helmet>
<title>Shared folders - Chainsafe Files</title>
</Helmet>
<SharedFoldersOverview />
</>
}

export default SharedFoldersPage
Loading