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

Rav 37 settings page with sidebar and page container #643

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion raven-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ProtectedRoute } from './utils/auth/ProtectedRoute'
import { UserProvider } from './utils/auth/UserProvider'
import { ChannelRedirect } from './utils/channel/ChannelRedirect'
import "cal-sans";
import { useState } from 'react'
import { ThemeProvider } from './ThemeProvider'
import { Toaster } from './components/common/Toast/Toaster'
import { FullPageLoader } from './components/layout/Loaders'
import { useStickyState } from './hooks/useStickyState'
import { Settings } from './pages/settings/Settings'


const router = createBrowserRouter(
Expand All @@ -23,6 +23,12 @@ const router = createBrowserRouter(
<Route path="saved-messages" lazy={() => import('./components/feature/saved-messages/SavedMessages')} />
<Route path=":channelID" lazy={() => import('@/pages/ChatSpace')} />
</Route>
<Route path='settings' element={<Settings />}>
<Route path='integrations'>
<Route path='webhooks' element={<p>Webhooks</p>} />
<Route path='server-scripts' element={<p>SS</p>} />
</Route>
</Route>
</Route>
</>
), {
Expand Down
39 changes: 39 additions & 0 deletions raven-app/src/components/feature/settings/Integrations.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { SidebarGroup, SidebarGroupItem, SidebarGroupLabel, SidebarGroupList, SidebarItem } from "@/components/layout/Sidebar"
import { Flex, Text } from "@radix-ui/themes"
import { BiPlug } from "react-icons/bi"

export interface Props { }

export const Integrations = (props: Props) => {
return (
<SidebarGroup>
<SidebarGroupItem gap='2' className={'pl-1.5'}>
{/* <SidebarViewMoreButton onClick={toggle} /> */}
<BiPlug />
<Flex width='100%' justify='between' align='center' gap='2'>
<Flex gap='3' align='center'>
<SidebarGroupLabel className='cal-sans'>Integrations</SidebarGroupLabel>
</Flex>
</Flex>
</SidebarGroupItem>
<SidebarGroup>
<SidebarGroupList>
<IntegrationsItem route='/settings/integrations/webhooks' label='Webhooks' />
<IntegrationsItem route='/settings/integrations/server-scripts' label='Server Scripts' />
</SidebarGroupList>
</SidebarGroup>
</SidebarGroup>
)
}


export const IntegrationsItem = ({ route, label }: { route: string, label: string }) => {

return (
<SidebarItem to={route ? route : "*"} className={'py-1.5'}>
<Flex justify='between' align={'center'} width='100%'>
<Text size='2' className="text-ellipsis line-clamp-1" as='span' weight={'regular'}>{label}</Text>
</Flex>
</SidebarItem>
)
}
24 changes: 24 additions & 0 deletions raven-app/src/components/layout/Settings/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Flex, Box, Separator } from "@radix-ui/themes"
import { SidebarBody } from "./SidebarBody"
import { SidebarFooter } from "../Sidebar/SidebarFooter"
import { SidebarHeader } from "./SidebarHeader"

export interface Props { }

/**
* Sidebar for Settings page
*/
export const Sidebar = (props: Props) => {
return (
<Flex justify='between' direction='row' gap='2'>
<Flex direction='column' gap='2' width='100%'>
<SidebarHeader />
<Box px='3'>
<Separator size='4' className={`bg-gray-4 dark:bg-gray-6`} />
</Box>
<SidebarBody />
</Flex>
<SidebarFooter />
</Flex>
)
}
14 changes: 14 additions & 0 deletions raven-app/src/components/layout/Settings/SidebarBody.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Integrations } from "@/components/feature/settings/Integrations"
import { ScrollArea, Flex } from "@radix-ui/themes"

export interface Props { }

export const SidebarBody = (props: Props) => {
return (
<ScrollArea type="hover" scrollbars="vertical" className='h-[calc(100vh-7rem)]'>
<Flex direction='column' gap='2' className='overflow-x-hidden' px='2'>
<Integrations />
</Flex>
</ScrollArea>
)
}
26 changes: 26 additions & 0 deletions raven-app/src/components/layout/Settings/SidebarHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Flex, Text } from "@radix-ui/themes"
import { BiChevronLeft } from "react-icons/bi"
import { useNavigate } from "react-router-dom"

export interface Props { }

export const SidebarHeader = (props: Props) => {

const navigate = useNavigate()

return (
<header>
<Flex
px='3'
align='center'
gap={'3'}
pt='1'
height='8'
onClick={() => navigate('/channel')}
>
<BiChevronLeft size={'24px'} color="gray" />
<Text as='span' size='4' weight={'medium'}>Settings</Text>
</Flex>
</header>
)
}
5 changes: 5 additions & 0 deletions raven-app/src/components/layout/Sidebar/SidebarFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export const SidebarFooter = () => {
Mobile App
</Link>
</DropdownMenu.Item>
<DropdownMenu.Item color='gray' className='group'>
<Link href="../settings" className='no-underline'>
Settings
</Link>
</DropdownMenu.Item>
<DropdownMenu.Item onClick={logout} color='red' className='cursor-pointer'>
Log Out
</DropdownMenu.Item>
Expand Down
20 changes: 20 additions & 0 deletions raven-app/src/pages/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Sidebar } from "@/components/layout/Settings/Sidebar"
import { Flex, Box } from "@radix-ui/themes"
import { Outlet } from "react-router-dom"

export interface Props { }

export const Settings = (props: Props) => {
return (
<>
<Flex>
<Box className={`w-64 bg-gray-2 border-r-gray-3 border-r dark:bg-gray-1`} left="0" top='0' position="fixed">
<Sidebar />
</Box>
<Box className='ml-[var(--sidebar-width)] w-[calc(100vw-var(--sidebar-width))] dark:bg-gray-2'>
<Outlet />
</Box>
</Flex>
</>
)
}
Loading