This commit is contained in:
Korbs 2024-07-17 21:05:04 -04:00
parent c0c266ef2f
commit dcd0c3e24f
8 changed files with 113 additions and 12 deletions

View file

@ -10,11 +10,10 @@
- [x] Email - [x] Email
- [x] Pasword - [x] Pasword
- [x] Delete Account - [x] Delete Account
- [ ] Password Recovery - [x] Banners (Success and Error Messages)
- [ ] Custom Error Pages from Supabase Reponse (400) - [ ] ~~Password Recovery~~ (Failed)
- [ ] 2FA Support - [ ] ~~Custom Error Pages from Supabase Reponse (400)~~ (FAILED)
- [ ] Passwordless Login (OTP Email) - [ ] ~~Passwordless Login (OTP Email)~~ (FAILED)
- [ ] Banners (Success and Error Messages)
## Setting Up Supabase ## Setting Up Supabase
### Selfhosting ### Selfhosting

View file

@ -0,0 +1,71 @@
---
if (Astro.url.href.endsWith('CheckEmail')) {var MessageCheckEmail = true}
else {var MessageCheckEmail = false}
if (Astro.url.href.endsWith('AvatarUpdated')) {var MessageAvatarUpdated = true}
else {var MessageAvatarUpdated = false}
if (Astro.url.href.endsWith('NameUpdated')) {var MessageNameUpdated = true}
else {var MessageNameUpdated = false}
if (Astro.url.href.endsWith('EmailConfirmed')) {var MessageEmailConfirmed = true}
else {var MessageEmailConfirmed = false}
if (Astro.url.href.endsWith('PasswordReset')) {var MessagePasswordReset = true}
else {var MessagePasswordReset = false}
---
{MessageCheckEmail ?
<div class="banner">
<p>Email has been updated, a confirmation email was sent.</p>
</div>
:
null
}
{MessageAvatarUpdated ?
<div class="banner">
<p>Avatar has been updated.</p>
</div>
:
null
}
{MessageNameUpdated ?
<div class="banner">
<p>Display name has been updated.</p>
</div>
:
null
}
{MessageEmailConfirmed ?
<div class="banner">
<p>Email has been confirmed.</p>
</div>
:
null
}
{MessagePasswordReset ?
<div class="banner">
<p>Password has been updated.</p>
</div>
:
null
}
<style lang="scss">
.banner {
background: #266426;
border: 1px #429f42 solid;
border-radius: 4px;
padding: 6px 12px;
font-size: 14px;
margin-bottom: 24px;
p {
margin: 0px;
}
}
</style>

View file

@ -1,5 +1,6 @@
--- ---
const {Title} = Astro.props const {Title} = Astro.props
import Banner from "@components/Banner.astro"
import Head from "@components/Head.astro" import Head from "@components/Head.astro"
import Header from "@components/Header.astro" import Header from "@components/Header.astro"
import '@styles/root.scss' import '@styles/root.scss'
@ -10,6 +11,7 @@ import '@styles/root.scss'
<Header/> <Header/>
<body> <body>
<div transition:animate="fade" class="content"> <div transition:animate="fade" class="content">
<Banner/>
<slot/> <slot/>
</div> </div>
</body> </body>

16
src/layouts/Error.astro Normal file
View file

@ -0,0 +1,16 @@
---
const {Title, Message} = Astro.props
import Head from "@components/Head.astro"
import Header from "@components/Header.astro"
import '@styles/root.scss'
---
<html>
<Head Title={Title}/>
<Header/>
<body>
<div transition:animate="fade" class="content">
<p>{Message}</p>
</div>
</body>
</html>

View file

@ -1,5 +1,6 @@
--- ---
const {Title} = Astro.props const {Title} = Astro.props
import Banner from "@components/Banner.astro"
import Head from "@components/Head.astro" import Head from "@components/Head.astro"
import Header from "@components/Header.astro" import Header from "@components/Header.astro"
import '@styles/root.scss' import '@styles/root.scss'
@ -10,6 +11,7 @@ import '@styles/root.scss'
<Header/> <Header/>
<body> <body>
<div transition:animate="fade" class="content"> <div transition:animate="fade" class="content">
<Banner/>
<div class="settings-panel"> <div class="settings-panel">
<div class="sp-sidebar"> <div class="sp-sidebar">
<a id="sb-s-account" href="/account">Account</a> <a id="sb-s-account" href="/account">Account</a>

12
src/pages/500.astro Normal file
View file

@ -0,0 +1,12 @@
---
import Base from "@layouts/Base.astro"
interface Props {
error: unknown
}
const { error } = Astro.props
---
<Base Title="Supabase Demo">
<div>{error instanceof Error ? error.message : 'Unknown error'}</div>
</Base>

View file

@ -0,0 +1,5 @@
---
import Base from "@layouts/Base.astro"
---
<Base Title="Supabase Demo" Message={'idk'}/>

View file

@ -19,16 +19,10 @@ const id = user?.id
const { data: channels, error } = await supabase const { data: channels, error } = await supabase
.from('channels') .from('channels')
.select('*') .select('*')
let { data: subs } = await supabase let { data: subs } = await supabase
.from('subs') .from('subs')
.select("*") .select("*")
.eq('UserSubscribed', id) .eq('UserSubscribed', id)
console.log(subs)
--- ---
<Base Title="Supabase Demo"> <Base Title="Supabase Demo">