Skip to content

Commit

Permalink
chore: bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
rustygreen committed Apr 10, 2024
1 parent 651026e commit 56777e1
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0-rc.14 (2024-04-10)

This was a version bump only, there were no code changes.

## 1.0.0-rc.13 (2024-03-26)

This was a version bump only, there were no code changes.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ _see more on these steps [here](https://nx.dev/recipes/nx-release/publish-in-ci-
## TODOs

- [x] Add SignedIn route guard
- [ ] Add avatar component
- [x] Add avatar component
- [ ] Add Roles route guard
- [ ] Implement Bootstrap components
- [ ] Implement Material components
Expand Down
2 changes: 1 addition & 1 deletion libs/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ng-supabase/bootstrap",
"version": "1.0.0-rc.13",
"version": "1.0.0-rc.14",
"author": "Rusty Green <me@rusty.green>",
"contributors": [
"Rusty Green <me@rusty.green>"
Expand Down
2 changes: 1 addition & 1 deletion libs/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ng-supabase/core",
"version": "1.0.0-rc.13",
"version": "1.0.0-rc.14",
"author": "Rusty Green <me@rusty.green>",
"contributors": [
"Rusty Green <me@rusty.green>"
Expand Down
2 changes: 2 additions & 0 deletions libs/core/src/lib/supabase-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ interface RegisterProperties {

interface ProfileProperties {
table?: string;
avatarField?: string;
firstNameField?: string;
lastNameField?: string;
}
Expand Down Expand Up @@ -105,6 +106,7 @@ class ProfileConfig implements ProfileProperties {
userIdField = 'user_id';
firstNameField = 'first_name';
lastNameField = 'last_name';
avatarField = 'avatar';

constructor(init?: Partial<ProfileProperties>) {
Object.assign(this, init);
Expand Down
19 changes: 15 additions & 4 deletions libs/core/src/lib/supabase.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class SupabaseService {
readonly userDisplayName = new BehaviorSubject<string>('');
readonly userSubheading = new BehaviorSubject<string>('');
readonly userProfile = new BehaviorSubject<unknown>(null);
readonly userAvatar = new BehaviorSubject<string | null>(null);
readonly signedIn = new BehaviorSubject<boolean>(false);
readonly loading = new BehaviorSubject<boolean>(true);
readonly clientReady: Promise<SupabaseClient>;
Expand Down Expand Up @@ -71,7 +72,7 @@ export class SupabaseService {

if (user && profileTable) {
this.log.debug(`Retrieving user profile for user ID '${user.id}'`);
const { error, data } = await this.client
const { error, data: profile } = await this.client
.from(profileTable)
.select()
.eq(this.config.profile.userIdField, user.id)
Expand All @@ -85,10 +86,17 @@ export class SupabaseService {
);
}

if (data) {
const firstName = data[this.config.profile.firstNameField];
const lastName = data[this.config.profile.lastNameField];
if (profile) {
const firstName = profile[this.config.profile.firstNameField];
const lastName = profile[this.config.profile.lastNameField];
const avatar = profile[this.config.profile.avatarField];
displayName = `${firstName || ''} ${lastName || ''}`.trim();
this.userProfile.next(profile);

if (avatar) {
this.userAvatar.next(avatar);
}

this.log.debug(
`Retrieving display name of '${displayName}' from profile`
);
Expand Down Expand Up @@ -170,5 +178,8 @@ export class SupabaseService {
this.session.next(null);
this.signedIn.next(false);
this.user.next(null);
this.userProfile.next(null);
this.userDisplayName.next('');
this.userSubheading.next('');
}
}
2 changes: 1 addition & 1 deletion libs/material/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ng-supabase/material",
"version": "1.0.0-rc.13",
"version": "1.0.0-rc.14",
"author": "Rusty Green <me@rusty.green>",
"contributors": [
"Rusty Green <me@rusty.green>"
Expand Down
2 changes: 1 addition & 1 deletion libs/primeng/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ng-supabase/primeng",
"version": "1.0.0-rc.13",
"version": "1.0.0-rc.14",
"author": "Rusty Green <me@rusty.green>",
"contributors": [
"Rusty Green <me@rusty.green>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[initials]="supabase.userDisplayName | async | initials"
[title]="(supabase.userDisplayName | async) || ''"
[subtitle]="(supabase.userSubheading | async) || ''"
[image]="supabase.userAvatar | async"
></supabase-user-avatar-button>
} @else {
<p-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[initials]="initials"
[title]="title"
[subtitle]="subtitle"
[image]="image"
></supabase-user-avatar>

@if(!loading){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export class UserAvatarButtonComponent extends CoreUserAvatarButtonComponent {
@Input() initials = '';
@Input() title = '';
@Input() subtitle = '';
@Input() image: string | null | undefined = '';
@Input() loading: boolean | null | undefined = false;
}
3 changes: 2 additions & 1 deletion libs/primeng/src/lib/user-avatar/user-avatar.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<p-avatar
[label]="loading ? '' : initials"
[label]="loading || image ? '' : initials"
[icon]="loading ? 'pi pi-spin pi-spinner' : ''"
[image]="image || undefined"
shape="circle"
styleClass="mr-2"
></p-avatar>
Expand Down
1 change: 1 addition & 0 deletions libs/primeng/src/lib/user-avatar/user-avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export class UserAvatarComponent {
@Input() initials = '';
@Input() title = '';
@Input() subtitle = '';
@Input() image: string | null | undefined = '';
@Input() loading: boolean | null | undefined = false;
}

0 comments on commit 56777e1

Please sign in to comment.