-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from websitesieutoc/making-home-page
Making home page
- Loading branch information
Showing
31 changed files
with
1,076 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import { Divider, Heading, Stack } from '@/components/chakra'; | ||
import { Divider, Heading, Stack, Text } from '@/components/chakra'; | ||
import { Logo } from '@/components/client'; | ||
|
||
import LoginButton from './login-button'; | ||
|
||
export default function LoginPage() { | ||
return ( | ||
<Stack gap={4} maxWidth="sm" marginX="auto" marginTop="10vh"> | ||
<Logo width={256} height={74} /> | ||
|
||
<Heading as="h1" size="lg"> | ||
Login | ||
</Heading> | ||
|
||
<Divider /> | ||
|
||
<LoginButton /> | ||
|
||
<Text fontSize="small" color="gray"> | ||
Only for members of @websitesieutoc at this time. | ||
</Text> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use client'; | ||
|
||
import { | ||
Box, | ||
Card, | ||
CardBody, | ||
CardHeader, | ||
Heading, | ||
Stack, | ||
StackDivider, | ||
Text, | ||
} from '@/components/chakra'; | ||
import { Session } from 'next-auth'; | ||
|
||
export type ProfileCardProps = { | ||
data: Session['user']; | ||
}; | ||
|
||
export const ProfileCard = ({ data }: ProfileCardProps) => { | ||
return ( | ||
<Card maxW="md"> | ||
<CardHeader> | ||
<Heading size="md">{data.name}</Heading> | ||
</CardHeader> | ||
|
||
<CardBody> | ||
<Stack divider={<StackDivider />} spacing="4"> | ||
<Box> | ||
<Heading size="xs" textTransform="uppercase"> | ||
</Heading> | ||
<Text pt="2" fontSize="sm"> | ||
{data.email} | ||
</Text> | ||
</Box> | ||
<Box> | ||
<Heading size="xs" textTransform="uppercase"> | ||
Role | ||
</Heading> | ||
<Text pt="2" fontSize="sm"> | ||
{data.role} | ||
</Text> | ||
</Box> | ||
</Stack> | ||
</CardBody> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ProfileCard'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import { Flex, Heading } from '@/components/chakra'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
// import { editUser } from '@/lib/actions/site'; | ||
import { getSession } from '@/lib/auth'; | ||
|
||
import { ProfileCard } from './components'; | ||
|
||
export default async function ProfileSettingsPage() { | ||
const session = await getSession(); | ||
|
||
if (!session) { | ||
redirect('/login'); | ||
} | ||
|
||
return ( | ||
<Flex width="100%" direction="column" gap={6}> | ||
<Flex height="48px" align="center"> | ||
<Heading as="h1" size="lg"> | ||
Profile Settings | ||
</Heading> | ||
</Flex> | ||
<Flex>{JSON.stringify(session.user)}</Flex> | ||
|
||
<ProfileCard data={session.user} /> | ||
</Flex> | ||
); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
components/client/SiteDeleteForm/index.tsx → .../[id]/components/SiteDeleteForm/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
'>puse client'; | ||
'use client'; | ||
|
||
import { | ||
AlertDialog, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
app/(dashboard)/sites/[id]/components/SiteTemplateEditor/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
'use client'; | ||
|
||
import { useColorModeValue, useState, useClipboard } from '@/hooks'; | ||
import { updateSiteSimple } from '@/lib/actions/site'; | ||
import { Fira_Mono } from 'next/font/google'; | ||
|
||
import { | ||
Button, | ||
Card, | ||
CardBody, | ||
CardFooter, | ||
CardHeader, | ||
Divider, | ||
Flex, | ||
FormControl, | ||
FormLabel, | ||
Heading, | ||
IconButton, | ||
Stack, | ||
Text, | ||
Textarea, | ||
} from '@/components/chakra'; | ||
import { CheckCircleIcon, CopyIcon, RepeatIcon, SaveIcon } from '@/icons'; | ||
import { Site } from '@/types'; | ||
|
||
export const fira_mono = Fira_Mono({ | ||
subsets: ['latin'], | ||
display: 'swap', | ||
weight: '400', | ||
}); | ||
|
||
type SiteTemplateEditorProps = { | ||
site: Site; | ||
}; | ||
|
||
export const SiteTemplateEditor = ({ site }: SiteTemplateEditorProps) => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
const [inputValue, setInputValue] = useState<string>(site.template ?? ''); | ||
|
||
const { onCopy, hasCopied } = useClipboard(inputValue); | ||
|
||
const footerBorder = useColorModeValue('gray.200', 'gray.600'); | ||
|
||
const codeBg = useColorModeValue('gray.100', 'gray.800'); | ||
|
||
const hasChanged = inputValue !== (site.template ?? ''); | ||
|
||
const handleSave = async () => { | ||
try { | ||
if (!site || !inputValue) return; | ||
|
||
setIsLoading(true); | ||
|
||
await updateSiteSimple(site.id, { template: inputValue }); | ||
} catch (error) { | ||
} finally { | ||
setIsLoading(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<Card direction="column" width="100%"> | ||
<CardHeader> | ||
<Heading size="md">Template Editor</Heading> | ||
</CardHeader> | ||
<CardBody> | ||
<Stack spacing={6}> | ||
<FormControl isDisabled={isLoading} w="100%" minW="240px"> | ||
<FormLabel>EasyPanel template</FormLabel> | ||
<Flex position="relative"> | ||
<Textarea | ||
className={fira_mono.className} | ||
spellCheck={false} | ||
bg={codeBg} | ||
rows={16} | ||
value={inputValue} | ||
onChange={(e) => setInputValue(e.target.value)} | ||
/> | ||
|
||
<IconButton | ||
icon={hasCopied ? <CheckCircleIcon color="green" /> : <CopyIcon />} | ||
colorScheme={hasCopied ? 'green' : 'gray'} | ||
variant="outline" | ||
aria-label="Copy" | ||
position="absolute" | ||
zIndex={3} | ||
right={2} | ||
top={2} | ||
onClick={onCopy} | ||
/> | ||
</Flex> | ||
</FormControl> | ||
</Stack> | ||
</CardBody> | ||
|
||
<Divider color={footerBorder} /> | ||
|
||
<CardFooter> | ||
<Flex width="100%" direction="row" justify="space-between" align="center"> | ||
<Text fontSize="sm" color="gray"> | ||
Use 64 characters maximum. | ||
</Text> | ||
|
||
<Stack direction="row"> | ||
{hasChanged && ( | ||
<Button | ||
aria-label="Reset" | ||
leftIcon={<RepeatIcon />} | ||
onClick={() => setInputValue(site.template ?? '')} | ||
> | ||
Reset | ||
</Button> | ||
)} | ||
|
||
<Button | ||
colorScheme={hasChanged ? 'green' : 'gray'} | ||
isDisabled={!hasChanged || isLoading} | ||
isLoading={isLoading} | ||
leftIcon={<SaveIcon />} | ||
onClick={handleSave} | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
</Flex> | ||
</CardFooter> | ||
</Card> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './SiteCustomDomainForm'; | ||
export * from './SiteDeleteForm'; | ||
export * from './SiteGeneralSettingsForm'; | ||
export * from './SiteQuickLinks'; | ||
export * from './SiteTemplateEditor'; |
Oops, something went wrong.