2
0

🚸 Add better page titles and dashboard icons

Closes #231
This commit is contained in:
Baptiste Arnaud
2023-01-26 17:04:37 +01:00
parent 9aab6ddb2c
commit ee864d9729
10 changed files with 25 additions and 26 deletions

View File

@ -1,13 +1,13 @@
import React from 'react'
import { HStack, Flex, Button, useDisclosure } from '@chakra-ui/react'
import { SettingsIcon } from '@/components/icons'
import { HardDriveIcon, SettingsIcon } from '@/components/icons'
import { signOut } from 'next-auth/react'
import { useUser } from '@/features/account'
import { useWorkspace, WorkspaceDropdown } from '@/features/workspace'
import { isNotDefined } from 'utils'
import Link from 'next/link'
import { TypebotLogo } from '@/components/TypebotLogo'
import { WorkspaceSettingsModal } from '@/features/workspace'
import { EmojiOrImageIcon } from '@/components/EmojiOrImageIcon'
export const DashboardHeader = () => {
const { user } = useUser()
@ -32,7 +32,11 @@ export const DashboardHeader = () => {
flex="1"
>
<Link href="/typebots" data-testid="typebot-logo">
<TypebotLogo w="30px" />
<EmojiOrImageIcon
boxSize="30px"
icon={workspace?.icon}
defaultIcon={HardDriveIcon}
/>
</Link>
<HStack>
{user && workspace && (

View File

@ -35,7 +35,7 @@ export const DashboardPage = () => {
return (
<Stack minH="100vh">
<Seo title="My typebots" />
<Seo title={workspace?.name ?? 'My typebots'} />
<DashboardHeader />
<TypebotDndProvider>
{isLoading ? (

View File

@ -18,12 +18,12 @@ import { GettingStartedModal } from './GettingStartedModal'
import { PreviewDrawer } from './PreviewDrawer'
import { TypebotHeader } from './TypebotHeader'
export const EditTypebotPage = () => {
export const EditorPage = () => {
const { typebot, isReadOnly } = useTypebot()
return (
<EditorProvider>
<Seo title="Editor" />
<Seo title={typebot?.name ? `${typebot.name} | Editor` : 'Editor'} />
<Flex overflow="clip" h="100vh" flexDir="column" id="editor-container">
<GettingStartedModal />
<TypebotHeader />

View File

@ -1,6 +1,6 @@
export { TypebotProvider, useTypebot } from './providers/TypebotProvider'
export { TypebotHeader } from './components/TypebotHeader'
export { EditTypebotPage } from './components/EditTypebotPage'
export { EditorPage } from './components/EditorPage'
export { headerHeight } from './constants'
export { BlockIcon } from './components/BlocksSideBar/BlockIcon'
export { RightPanel, useEditor } from './providers/EditorProvider'

View File

@ -88,7 +88,7 @@ export const SharePage = () => {
return (
<Flex flexDir="column" pb="40">
<Seo title="Share" />
<Seo title={typebot?.name ? `${typebot.name} | Share` : 'Share'} />
<TypebotHeader />
<Flex h="full" w="full" justifyContent="center" align="flex-start">
<Stack maxW="1000px" w="full" pt="10" spacing={10}>

View File

@ -89,7 +89,15 @@ export const ResultsPage = () => {
return (
<Flex overflow="hidden" h="100vh" flexDir="column">
<Seo
title={router.pathname.endsWith('analytics') ? 'Analytics' : 'Results'}
title={
router.pathname.endsWith('analytics')
? typebot?.name
? `${typebot.name} | Analytics`
: 'Analytics'
: typebot?.name
? `${typebot.name} | Results`
: 'Results'
}
/>
<TypebotHeader />
{chatsLimitPercentage > ALERT_CHATS_PERCENT_THRESHOLD && (

View File

@ -17,7 +17,7 @@ export const SettingsPage = () => {
return (
<Flex overflow="hidden" h="100vh" flexDir="column">
<Seo title="Settings" />
<Seo title={typebot?.name ? `${typebot.name} | Settings` : 'Settings'} />
<TypebotHeader />
<Flex h="full" w="full">
<SettingsSideMenu />

View File

@ -12,7 +12,7 @@ export const ThemePage = () => {
return (
<Flex overflow="hidden" h="100vh" flexDir="column">
<Seo title="Theme" />
<Seo title={typebot?.name ? `${typebot.name} | Theme` : 'Theme'} />
<TypebotHeader />
<Flex h="full" w="full">
<ThemeSideMenu />

View File

@ -12,7 +12,6 @@ import {
MenuButton,
Button,
HStack,
SkeletonCircle,
MenuList,
MenuItem,
Text,
@ -40,18 +39,6 @@ export const WorkspaceDropdown = ({
<Menu placement="bottom-end">
<MenuButton as={Button} variant="outline" px="2">
<HStack>
<SkeletonCircle
isLoaded={currentWorkspace !== undefined}
alignItems="center"
display="flex"
boxSize="20px"
>
<EmojiOrImageIcon
boxSize="20px"
icon={currentWorkspace?.icon}
defaultIcon={HardDriveIcon}
/>
</SkeletonCircle>
{currentWorkspace && (
<>
<Text noOfLines={1} maxW="200px">

View File

@ -1,5 +1,5 @@
import { EditTypebotPage } from '@/features/editor'
import { EditorPage } from '@/features/editor'
export default function Page() {
return <EditTypebotPage />
return <EditorPage />
}