Skip to content

Commit 244f022

Browse files
authored
Merge pull request #479 from CodingCatDev/dev
Release - 2022-06-13
2 parents 272dd12 + 1dc4011 commit 244f022

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

apps/codingcatdev/src/lib/server/firebase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { env as privateEnv } from '$env/dynamic/private';
1010

1111
export let app = getApps().at(0);
1212

13-
let auth: Auth;
1413
let db: Firestore;
1514

1615
if (!app && publicEnv.PUBLIC_FB_PROJECT_ID && privateEnv.PRIVATE_FB_CLIENT_EMAIL && privateEnv.PRIVATE_FB_PRIVATE_KEY) {
@@ -22,7 +21,6 @@ if (!app && publicEnv.PUBLIC_FB_PROJECT_ID && privateEnv.PRIVATE_FB_CLIENT_EMAIL
2221
})
2322
});
2423

25-
auth = getAuth(app);
2624
db = getFirestore(app);
2725
}
2826

@@ -31,7 +29,7 @@ if (!app && publicEnv.PUBLIC_FB_PROJECT_ID && privateEnv.PRIVATE_FB_CLIENT_EMAIL
3129
export const ccdCreateSessionCookie = async (idToken: string) => {
3230
// Set session expiration to 5 days.
3331
const expiresIn = 60 * 60 * 24 * 5 * 1000;
34-
32+
const auth = getAuth(app);
3533
const sessionCookie = await auth.createSessionCookie(idToken, { expiresIn });
3634
// Set cookie policy for session cookie.
3735
const options = { maxAge: expiresIn, httpOnly: true, secure: true };
@@ -44,10 +42,12 @@ export const ccdCreateSessionCookie = async (idToken: string) => {
4442
};
4543

4644
export const ccdValidateSessionCookie = async (session: string) => {
45+
const auth = getAuth(app);
4746
return await auth.verifySessionCookie(session, true);
4847
}
4948

5049
export const validateStripeRole = async (uid: string) => {
50+
const auth = getAuth(app);
5151
const user = await auth.getUser(uid);
5252
return user.customClaims?.['stripeRole']
5353
}

apps/codingcatdev/src/routes/(layout-partials)/CcdAppBar.svelte

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,24 @@
8282
use:popup={{ event: 'click', target: 'theme' }}
8383
>
8484
{#if $storeUser?.picture}
85-
<Avatar class="bcu-avatar-xs w-8 h-8" src={$storeUser.picture} alt="User Photo" />
85+
<Avatar
86+
class="w-8 h-8 bcu-avatar-xs"
87+
src={$storeUser.picture}
88+
alt="User Photo"
89+
referrerpolicy="no-referrer"
90+
/>
8691
{:else}
87-
<Avatar class="bcu-avatar-xs w-8 h-8">
92+
<Avatar class="w-8 h-8 bcu-avatar-xs">
8893
<svelte:fragment slot="bcu-avatar-message">
8994
<div class="text-sm">AJ</div>
9095
</svelte:fragment>
9196
</Avatar>
9297
{/if}
9398
</button>
9499
<!-- popup -->
95-
<div class="bcu-card flex flex-col gap-4 p-4 w-60 shadow-xl" data-popup="theme">
96-
<div class="space-y-4 mb-2">
97-
<section class="flex justify-between items-center">
100+
<div class="flex flex-col gap-4 p-4 shadow-xl bcu-card w-60" data-popup="theme">
101+
<div class="mb-2 space-y-4">
102+
<section class="flex items-center justify-between">
98103
<h6>Mode</h6>
99104
<LightSwitch />
100105
</section>

apps/codingcatdev/src/routes/(protected)/account/AccountCard.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@
44
55
import { openStripePortal } from '$lib/client/firebase';
66
import LogoutButton from '../../login/LogoutButton.svelte';
7+
import { Avatar } from '@codingcatdev/blackcatui';
78
</script>
89

9-
<div class="bcu-card flex flex-col md:flex-row justify-between gap-2 md:gap-8 w-full">
10-
<div class="flex flex-col md:flex-row md:justify-between w-full p-8 gap-4 md:gap-8">
10+
<div class="flex flex-col justify-between w-full gap-2 bcu-card md:flex-row md:gap-8">
11+
<div class="flex flex-col w-full gap-4 p-8 md:flex-row md:justify-between md:gap-8">
1112
<div class="md:w-1/3">
1213
<h2 class="mb-8">Account</h2>
1314
<p>Your account details</p>
1415
</div>
15-
<div class="bcu-card variant-filled p-8 flex flex-col gap-4 md:w-2/3">
16+
<div class="flex flex-col gap-4 p-8 bcu-card variant-filled md:w-2/3">
1617
<div class="flex items-center gap-4">
1718
<p class="text-lg">Your Email:</p>
1819
<p>{data?.user?.email}</p>
1920
</div>
2021
<div class="flex items-center gap-4">
2122
<p class="text-lg">Your Avatar:</p>
22-
<img
23-
class="w-20"
23+
<Avatar
24+
class="w-20 h-20 bcu-avatar-xs"
2425
src={data.user ? data.user.picture : '/images/avatar.png'}
25-
alt="User's avatar"
26+
alt="User Photo"
27+
referrerpolicy="no-referrer"
2628
/>
2729
</div>
2830
<LogoutButton />

apps/codingcatdev/src/routes/(protected)/dashboard/DashboardWelcome.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<script lang="ts">
2+
import { Avatar } from '@codingcatdev/blackcatui';
23
import type { PageData } from './$types';
34
export let data: PageData;
45
</script>
56

67
<div
7-
class="bcu-card variant-filled min-h-full flex flex-col w-full justify-center items-start gap-4 p-8"
8+
class="flex flex-col items-start justify-center w-full min-h-full gap-4 p-8 bcu-card variant-filled"
89
>
910
<div class="flex items-center gap-4">
10-
<img src={data.user ? data.user.picture : '/images/avatar.png'} alt="User's avatar" />
11+
<Avatar
12+
class="w-20 h-20 bcu-avatar-xs"
13+
src={data.user ? data.user.picture : '/images/avatar.png'}
14+
alt="User Photo"
15+
referrerpolicy="no-referrer"
16+
/>
1117
<h2 class="text-md">Welcome, {data.user?.email}!</h2>
1218
</div>
1319
<p class="p-2">Now that you're here, get involved!</p>

0 commit comments

Comments
 (0)