mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Adding Code snippet.
This commit is contained in:
@@ -19,17 +19,13 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
if (!user) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const userInfo = await prisma.user.findUnique({
|
||||
where: {
|
||||
email: user.email
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
return (
|
||||
<Page>
|
||||
{/*<PageHeader>*/}
|
||||
<div className="justify-between gap-2 sm:flex">
|
||||
<PageTitle className="flex items-center">
|
||||
<AvatarWithUpload user={userInfo}/>
|
||||
@@ -40,7 +36,6 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
<ButtonDeleteAccount/>
|
||||
</PageActions>
|
||||
</div>
|
||||
{/*</PageHeader>*/}
|
||||
<PageContent>
|
||||
<UserForm userId={userInfo.id} defaultValues={userInfo}/>
|
||||
</PageContent>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {PropsWithChildren} from "react";
|
||||
|
||||
|
||||
export type CodeSnippetProps = PropsWithChildren<{}>;
|
||||
|
||||
export const CodeSnippet = (props: CodeSnippetProps) => {
|
||||
|
||||
return (
|
||||
<div className="prose prose-invert">
|
||||
<pre className="bg-[#1e1e1e] rounded-md p-4">
|
||||
<code className="language-javascript text-[#d4d4d4]">{`
|
||||
${props.children}
|
||||
`}</code>
|
||||
</pre>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -23,9 +23,6 @@ export const LoggedInDropdown = (props: LoggedInDropdownProps) => {
|
||||
}}>
|
||||
<span>Account</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<span>Billing</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => {
|
||||
signOutAction()
|
||||
}}>
|
||||
|
||||
@@ -18,20 +18,14 @@ export const uploadImageAction = userAction
|
||||
const fileName = uuid + "." + fileFormat
|
||||
const arrayBuffer = await file.arrayBuffer()
|
||||
const buffer = Buffer.from(arrayBuffer)
|
||||
|
||||
const localDir = "public/uploads/"
|
||||
|
||||
try {
|
||||
|
||||
await mkdir(path.join(process.cwd(), localDir), { recursive: true });
|
||||
|
||||
const result = await writeFile(
|
||||
path.join(process.cwd(), localDir + fileName),
|
||||
buffer
|
||||
);
|
||||
|
||||
let url: string = "";
|
||||
|
||||
if (env.NODE_ENV === "production") {
|
||||
// url = `https://${env.S3_ENDPOINT}/${bucketName}/${fileName}`
|
||||
} else {
|
||||
@@ -40,7 +34,6 @@ export const uploadImageAction = userAction
|
||||
return {
|
||||
data: {result: result, url: url},
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log("Error occured ", error);
|
||||
throw new Error('An error occured while importing image');
|
||||
|
||||
Reference in New Issue
Block a user