Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing Alpha Branch #3201

Merged
merged 27 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
629cfd6
chore(nx): minor update to nx v20.0.12
h0lybyte Nov 10, 2024
571ea9b
Merge pull request #3200 from KBVE/patch-atomic-nx-update-11-10-2024-…
h0lybyte Nov 10, 2024
41bd571
docs(journal): small update to journal and removed node-appwrite.
h0lybyte Nov 10, 2024
cafec84
chore(deps): removing preact from the package, as it is no longer nee…
h0lybyte Nov 10, 2024
936f678
Merge pull request #3202 from KBVE/patch-atomic-more-updates-11-10-20…
h0lybyte Nov 10, 2024
82a38f9
doc(journal): small note for later today.
h0lybyte Nov 10, 2024
69b8ce8
chore(astro): removed the vue integration for now.
h0lybyte Nov 10, 2024
52fc2fe
Merge pull request #3203 from KBVE/patch-atomic-astro-cleanup-11-10-2…
h0lybyte Nov 10, 2024
6de00aa
docs(journal): daily notes
h0lybyte Nov 10, 2024
19c8e73
fix(kilobase): updating the user cards to be managed directly via RLS.
h0lybyte Nov 10, 2024
819a360
fix(kilobase): user_card sql drops were out of order.
h0lybyte Nov 10, 2024
2b67176
docs(journal): updating the daily notes.
h0lybyte Nov 10, 2024
a6b50be
feat(expo-bbq): preparing the expo onboarding component.
h0lybyte Nov 10, 2024
4dbbf4f
feat(expo-bbq): added the base TamaOnboard component.
h0lybyte Nov 10, 2024
50f4437
docs(journal): updating the daily notes..
h0lybyte Nov 10, 2024
300874b
perf(expo-bbq): wrapped the userData into a memo.
h0lybyte Nov 10, 2024
e2cc29c
docs(journal): additional notes for the expo.
h0lybyte Nov 10, 2024
c997d20
refactor(expo-bbq): updating the onboard to pass up the onSuccess and…
h0lybyte Nov 10, 2024
6c4d2e9
feat(expo-bbq): added the export of the onboarding.
h0lybyte Nov 10, 2024
a29b795
fix(kilobase): adjusted the username function for onboarding to retur…
h0lybyte Nov 10, 2024
a2043ed
fix(expo-bbq): updated the onboarding, still need to adjust the userc…
h0lybyte Nov 10, 2024
d298547
Merge pull request #3204 from KBVE/patch-atomic-astro-fix-11-10-2024-…
h0lybyte Nov 10, 2024
7d95c3e
Merge pull request #3206 from KBVE/patch-atomic-preparing-the-expo-pr…
h0lybyte Nov 10, 2024
aff28a8
fix(expo-lcagents): added missing onboard screen to the layout.
h0lybyte Nov 11, 2024
a96ebee
Merge pull request #3207 from KBVE/patch-atomic-updating-the-layout-1…
h0lybyte Nov 11, 2024
f5cf658
feat(expo-bbq): adding a base user schema.
h0lybyte Nov 11, 2024
0291732
Merge pull request #3208 from KBVE/patch-atomic-updating-the-onboard-…
h0lybyte Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/expo-lcagents/src/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ function RootLayoutNav() {
<Stack.Screen name="register" options={{ animation: 'fade' }} />
<Stack.Screen name="login" options={{ animation: 'fade' }} />
<Stack.Screen name="profile" options={{ animation: 'fade' }} />
<Stack.Screen name="onboard" options={{ animation: 'fade' }} />


</Stack>

Expand Down
119 changes: 119 additions & 0 deletions apps/expo-lcagents/src/app/onboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import React, { useMemo, useCallback, useEffect, useState, useRef } from 'react';
import { YStack, XStack, SizableText, Separator, ScrollView, Button } from 'tamagui';
import { TamaOnboard, LottieAnimation, TamaSheet, useBBQ } from '@kbve/expo-bbq';
import { useNavigation } from 'expo-router';

const Onboard = () => {

// [C ~~> Nav[]]
const navigation = useNavigation();
const router = useBBQ();
// [Sheet]
const sheetRef = useRef<{
showSheet: () => void;
hideSheet: () => void;
} | null>(null);

// [States]
const [sheetMessage, setSheetMessage] = useState('');
const [isComplete, setIsComplete] = useState(false);
const [hasError, setHasError] = useState(false);

// [Lottie] => (Memo) -> JSON animation for the onboarding screen, since its a static asset.
const lottieOnboardAnimation = useMemo(
() => require('../../assets/json/360-vr.json'),
[],
);

// [Navigation] => (useCallback) <~> (useEffect)
const updateNavigationOptions = useCallback(() => {
navigation.setOptions({
title: 'Onboarding',
headerBackTitle: 'Back',
});

}, [navigation]);

useEffect(
() => {
updateNavigationOptions();
}, [updateNavigationOptions]
);

// [onSuccess] ?=>
const handleSuccess = () => {
setIsComplete(true);
setHasError(false);
// [i18n] ?? NULL => TamaI18N('[onboard_true']); ($->trigger)
setSheetMessage('Onboarding completed successfully!');
if(sheetRef.current) {
sheetRef.current.showSheet();
}
};

// [onError] ?=>
const handleError = (error: string) => {
setIsComplete(false);
setHasError(true);
// [i18n] ?? NULL => TamaI18N('[onboard_error']); ($->trigger)[error:key]
if(sheetRef.current) {
sheetRef.current.showSheet();
}
};


const renderSheetContent = () => {
return (
<YStack ai="center" jc="center" paddingVertical={10}>
<SizableText>{sheetMessage}</SizableText>
{isComplete && !hasError && (
<Button
onPress={() => {
if (sheetRef.current) {
sheetRef.current.hideSheet();
}
router.go('/profile'); // Navigate to the profile page after successful onboarding
}}
color="green"
size="$4"
marginTop={10}
>
Go to Profile
</Button>
)}
</YStack>
);
};

const MemoizedLottieAnimation = React.memo(LottieAnimation);

return (
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<YStack f={1} jc="center" ai="center" padding="$4">
<SizableText size="$4" theme="alt2">Welcome to Onboarding</SizableText>
<MemoizedLottieAnimation
lottieJSON={lottieOnboardAnimation}
style={{
width: 150,
height: 'auto',
aspectRatio: 1,
maxWidth: 800,
}}
/>
<TamaOnboard
supabaseUrl="https://supabase.kbve.com"
supabaseAnonKey="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJyb2xlIjogImFub24iLAogICJpc3MiOiAic3VwYWJhc2UiLAogICJpYXQiOiAxNzI0NTM2ODAwLAogICJleHAiOiAxODgyMzAzMjAwCn0._fmEmblm0afeLoPXxt8wP2mYpa9gzU-ufx3v8oRTFGg"
onSuccess={handleSuccess}
onError={handleError}
/>
</YStack>

<TamaSheet ref={sheetRef} title="Onboarding Status">
{renderSheetContent()}
</TamaSheet>
</ScrollView>
);

};

export default Onboard;
139 changes: 139 additions & 0 deletions apps/kbve.com/src/content/journal/11-10.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: 'November: 10th'
category: Daily
date: 2024-11-10 12:00:00
client: Self
unsplash: 1721332154373-17e78d19b4a4
img: https://images.unsplash.com/photo-1721332154373-17e78d19b4a4?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: November 10th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 07:13AM

**Nx Update**

Updated the monorepo to nx v20.0.12.
Also moved up the build process to see where the main branch fails, hopefully we can address that problem tonight.

**Main**

The branch seems to build without any major issues, but it did skip a couple libraries from being built.
What we could do is try to maybe start changing the triggers to be all via readme updates?
Hmm, I will have to think through it again, let me get some coffee and revisit this concept again within the next hour.

**Package**

I am going to go through the package again and see if there are any libraries that we need to update or remove.
We are no longer supporting `appwrite`, so lets go ahead and remove that one.
I believe we can also drop the `preact` libraries as well.
`"@astrojs/preact": "^3.5.3"` and `preact` both could be removed.

- 07:30AM

**Vue**

We can take out the `vue` package as well, following the same command from the `preact` earlier.
```shell
pnpm remove @astrojs/vue vue
```

However I will run those later when I get back to the monorepo.
After we run that, we will need to make sure to clean up the cache.

```shell
pnpm nx reset
```

- 08:53AM

**Unity**

I grabbed the ERW tilesets from Matos and threw them into the `Rareicon` asset folder.
With the generic collection of tilesets, we should have enough to build a couple generic maps.
Now the bigger question would be to figure out how to get the hang of the animation.

**Supabase**

While making changes to the Unity configuration, I can spend some time thinking through the changes that I want to do with the `user_cards`.
One of the goals for the user cards after this base update will be to pull the stats from the character sheet and render them.
We want the goal of the card to contain all the public information that a random guest or user would require.
So lets take abit of a step back and review the psql for it.

We will keep parts of the table, like the `CONSTRAINT` for the function, example:

```sql

CONSTRAINT bio_length CHECK (char_length(bio) <= 255), -- Limit bio length to 255 characters
CONSTRAINT bio_format CHECK (bio ~ '^[a-zA-Z0-9.!? ]*$'), -- Allow alphanumeric characters, spaces, and basic punctuation

```

Okay, yet the `JSONB` needs to be adjusted within the function because it does not let specific nulls through, like if the user has a github but not a twitter.

Wait I am a tart, I can just drop these functions and use the row level security to handle the updating and managing of the table.
Thus the PSQL will make this so much easier to manage in the future, yay!
Okay so we will just run these and move forward with the current project.

```sql

BEGIN;

-- Drop older trigger and function
DROP TRIGGER IF EXISTS on_auth_new_card_created ON auth.users;
DROP FUNCTION IF EXISTS public.handle_user_card_update();
DROP FUNCTION IF EXISTS public.handle_new_user_card();
DROP TRIGGER IF EXISTS handle_user_card_update ON public.user_cards;

COMMIT;

```

Then we can update the command to just handle these directly for us.
Oh I made another silly mistake, I have to drop the triggers first then the functions!
Let me go ahead and fix that up really quick.

- 11:30AM

**Expo**

Okay after migrating both the user profile and the user card out of the sign up process, we can begin building out the onboarding process.
This process will have to be done on both the `@kbve/laser` project and also in the `@kbve/expo-bbq`, since we need to include this for both astro and expo.
In both situations, I will open four instances of VS Code and tackle them all at the same time!
This is the peak of development, my brain is going to be broken as I do this xD
Under the current expo, it will be `packages/expo-bbq/src/components/auth/user/TamaOnboard.tsx` and then inside of that we can build out the component!
This would be the barebone component, aka, `TamaOnboard`, and it would have two states that it would manage.
The first state would be for the `username` and making sure that it is unique before setting it up, however it would be noted that it is the user's public username.
The second state would be for the profile card, the core specific here would be preparing the basic information for the init card.
Hmm, okay these two states should be enough for us to move forward, I believe we can always go back around and double check the onboarding when it goes live into production.

I am thinking that for error management, we should push the error up in the component, so that the parent component that calls the Tamaonboard can process the error?
This would be easier for us to handle, without having to create multiple error handlers inside of the sub-components, okay let me do that next.

To keep with the standard, the TamaOnBoard will pass up an `OnError` and `OnSuccess` void, both of which can then be managed by the parent component.
This means we can remove the redirect that is hard coded into the component, yet it does mean we can not specifically highlight where the error is exactly in the form?

Next, we need to create the actual `onboard.tsx` that we will be using in the expo-lcagents?!
Since this page will be similar to our login / profile, we can strip them down and grab the components that will be useful for the onboarding.
The goal will be to keep it simple enough to push towards production, then we can loop back around and work on resolving the specific bugs.
I do know that the username being taken would be a bug or if the username format is off, both of which we can resolve through the onboarding component.
Besides those two additions, I am not too sure what else the onboarding would need?
I guess we could have them double check the legal docs as well before moving forward, but that is up to the client as well.
Having the legal documents be a combination is a cool future-like concept but there would be a decent amount of work that has to go into setting that up.

Then there is the actual content that the website would have, maybe since we are already data mining different job sites, we could link that data back into the website.
That could be a great way to drive up natural traffic to the site too.

Updating the `public.create_user_profile` function to return the new username after it gets created.
Okay let me push this through as the most recent update!

**FredAgain**

While working on the expo component, I am jamming to that radio session with Fred and Jim!
The whole work is flames, just nearly a perfect set for this expo work.
Here is the link to the [set](https://www.youtube.com/watch?v=DE_yVb3JMD8), which should be thrown into that future music application.
22 changes: 22 additions & 0 deletions apps/kbve.com/src/content/journal/11-11.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: 'November: 11th'
category: Daily
date: 2024-11-11 12:00:00
client: Self
unsplash: 1721332154373-17e78d19b4a4
img: https://images.unsplash.com/photo-1721332154373-17e78d19b4a4?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: November 11th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 02:18AM

**Screen**

Forgot to add the screen for the `onboard` section.
Let me go ahead and push that up.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN;

-- Drop the triggers first
DROP TRIGGER IF EXISTS on_auth_new_card_created ON auth.users;
DROP TRIGGER IF EXISTS handle_user_card_update ON public.user_cards;

-- Then drop the functions
DROP FUNCTION IF EXISTS public.handle_user_card_update();
DROP FUNCTION IF EXISTS public.handle_new_user_card();

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ BEGIN;
-- Drop the function and trigger for creating an empty user profile row on registration
DROP TRIGGER IF EXISTS on_auth_user_created ON auth.users;
DROP FUNCTION IF EXISTS public.handle_new_user_profile();

DROP FUNCTION IF EXISTS public.create_user_profile(_username TEXT);

-- Function to create a user profile using the caller's UUID
CREATE OR REPLACE FUNCTION public.create_user_profile(_username TEXT)
RETURNS VOID AS $$
RETURNS TEXT AS $$
DECLARE
_user_id UUID := auth.uid(); -- Automatically get the UUID of the caller
BEGIN
Expand Down Expand Up @@ -41,8 +41,12 @@ BEGIN
-- Insert the profile with the username if it doesn't already exist
INSERT INTO public.user_profiles (id, username)
VALUES (_user_id, _username);

-- Return the created username
RETURN _username;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;



COMMIT;
Loading
Loading