mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: refactor the entire learnhouse project
This commit is contained in:
parent
f556e41dda
commit
4c215e91d5
247 changed files with 7716 additions and 1013 deletions
|
|
@ -1,122 +0,0 @@
|
|||
"use client";
|
||||
import React, { createContext, useState } from 'react'
|
||||
import { styled } from '@stitches/react';
|
||||
import Link from 'next/link';
|
||||
import LearnHouseWhiteLogo from '@public/learnhouse_text_white.png';
|
||||
import AuthProvider, { AuthContext } from '@components/Security/AuthProvider';
|
||||
import Avvvatars from 'avvvatars-react';
|
||||
import Image from 'next/image';
|
||||
import AuthenticatedClientElement from '@components/Security/AuthenticatedClientElement';
|
||||
import { getOrganizationContextInfo } from '@services/organizations/orgs';
|
||||
|
||||
async function SettingsLayout({ children, params }: { children: React.ReactNode, params: any }) {
|
||||
const auth: any = React.useContext(AuthContext);
|
||||
const orgslug = params.orgslug;
|
||||
|
||||
let org = await getOrganizationContextInfo(orgslug, {});
|
||||
|
||||
return (
|
||||
<>
|
||||
<AuthProvider>
|
||||
<Main>
|
||||
<LeftWrapper>
|
||||
<LeftTopArea>
|
||||
|
||||
<Link href={"/"}><Image alt="Learnhouse logo" width={128} src={LearnHouseWhiteLogo} /></Link>
|
||||
{auth.isAuthenticated && (
|
||||
<Avvvatars value={auth.userInfo.user_object.user_id} style="shape" />
|
||||
)}
|
||||
</LeftTopArea>
|
||||
<LeftMenuWrapper>
|
||||
<MenuTitle>Account</MenuTitle>
|
||||
<ul>
|
||||
<li><Link href="/settings/account/profile">Profile</Link></li>
|
||||
<li><Link href="/settings/account/passwords">Passwords</Link></li>
|
||||
</ul>
|
||||
<AuthenticatedClientElement checkMethod='roles' orgId={org.org_id} >
|
||||
<MenuTitle>Organization</MenuTitle>
|
||||
<ul>
|
||||
<li><Link href="/settings/organization/general">General</Link></li>
|
||||
</ul>
|
||||
</AuthenticatedClientElement>
|
||||
</LeftMenuWrapper>
|
||||
</LeftWrapper>
|
||||
<RightWrapper>
|
||||
{children}
|
||||
</RightWrapper>
|
||||
</Main></AuthProvider>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default SettingsLayout
|
||||
|
||||
|
||||
const Main = styled('div', {
|
||||
display: 'flex',
|
||||
})
|
||||
|
||||
const LeftWrapper = styled('div', {
|
||||
width: '270px',
|
||||
background: "linear-gradient(348.55deg, #010101 -8.61%, #343434 105.52%);",
|
||||
height: '100vh',
|
||||
padding: '20px',
|
||||
})
|
||||
|
||||
const LeftTopArea = styled('div', {
|
||||
display: 'flex',
|
||||
marginLeft: '20px',
|
||||
|
||||
alignItems: 'center',
|
||||
|
||||
img: {
|
||||
marginRight: '20px',
|
||||
},
|
||||
|
||||
a: {
|
||||
display: 'flex',
|
||||
placeItems: 'center',
|
||||
placeContent: 'center',
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const LeftMenuWrapper = styled('div', {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
padding: '20px',
|
||||
|
||||
ul: {
|
||||
listStyle: 'none',
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
li: {
|
||||
marginBottom: '10px',
|
||||
a: {
|
||||
color: '#ffffff8c',
|
||||
textDecoration: 'none',
|
||||
fontSize: '14px',
|
||||
fontWeight: 'bold',
|
||||
'&:hover': {
|
||||
textDecoration: 'underline',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const MenuTitle = styled('h3', {
|
||||
color: 'white',
|
||||
fontSize: '18px',
|
||||
fontWeight: 'bold',
|
||||
marginBottom: '20px',
|
||||
})
|
||||
|
||||
const RightWrapper = styled('div', {
|
||||
flex: 1,
|
||||
padding: '20px',
|
||||
boxSizing: 'border-box',
|
||||
margin: '40px',
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue