Skip to content

Commit

Permalink
🚸 Add better page titles and dashboard icons
Browse files Browse the repository at this point in the history
Closes #231
  • Loading branch information
baptisteArno committed Jan 26, 2023
1 parent 9aab6dd commit ee864d9
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const DashboardPage = () => {

return (
<Stack minH="100vh">
<Seo title="My typebots" />
<Seo title={workspace?.name ?? 'My typebots'} />
<DashboardHeader />
<TypebotDndProvider>
{isLoading ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/features/editor/index.ts
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion apps/builder/src/features/publish/components/SharePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand Down
10 changes: 9 additions & 1 deletion apps/builder/src/features/results/components/ResultsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/features/theme/components/ThemePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
MenuButton,
Button,
HStack,
SkeletonCircle,
MenuList,
MenuItem,
Text,
Expand Down Expand Up @@ -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">
Expand Down
4 changes: 2 additions & 2 deletions apps/builder/src/pages/typebots/[typebotId]/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EditTypebotPage } from '@/features/editor'
import { EditorPage } from '@/features/editor'

export default function Page() {
return <EditTypebotPage />
return <EditorPage />
}

0 comments on commit ee864d9

Please sign in to comment.