Skip to content

Commit

Permalink
fix: #1044 (cont);
Browse files Browse the repository at this point in the history
  • Loading branch information
migbash committed Feb 17, 2023
1 parent 6f58d97 commit 4a3090b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
13 changes: 8 additions & 5 deletions src/lib/components/page/profile/Modal-ConnectWallet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ COMPONENT JS (w/ TS)
import wallet from './assets/wallet.svg';
import metamask_icon from './assets/metamask.svg';
import { dlog, PR_P_STY, PR_P_TAG, PR_P_TOG } from '$lib/utils/debug';
import type { REDIS_CACHE_SINGLE_profile_translation } from '$lib/models/profile/account-setting/types';
import { page } from '$app/stores';
// ~~~~~~~~~~~~~~~~~~~~~
// COMPONENT VARIABLES
// ~~~~~~~~~~~~~~~~~~~~~
export let RESPONSE_PROFILE_DATA: REDIS_CACHE_SINGLE_profile_translation;
$: RESPONSE_PROFILE_DATA = $page.data.RESPONSE_PROFILE_DATA;
const dispatch = createEventDispatcher();
// ~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -186,7 +191,7 @@ COMPONENT HTML
color-black-2
"
>
Cryptocurrency wallet
{RESPONSE_PROFILE_DATA?.crypto_title}
</p>
<!--
[ℹ] delete account desc. info
Expand All @@ -198,9 +203,7 @@ COMPONENT HTML
color-grey
"
>
Connect your crypto wallet to your Paragraph
account. This lets you login using your wallet
and unlock other web3 functionality.
{RESPONSE_PROFILE_DATA?.crypto_desc}
</p>
<!--
[ℹ] connect wallet action (btn)
Expand All @@ -220,7 +223,7 @@ COMPONENT HTML
alt="metamask icon"
class="m-r-16"
/>
Connect with MetaMask
{RESPONSE_PROFILE_DATA?.connect_wallet_title} Metamask
</button>
</div>

Expand Down
15 changes: 9 additions & 6 deletions src/lib/components/page/profile/Modal-DeleteAccount.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
COMPONENT JS (w/ TS)
=================-->
<script lang="ts">
import { page } from '$app/stores';
import type { REDIS_CACHE_SINGLE_profile_translation } from '$lib/models/profile/account-setting/types';
import { userBetarenaSettings } from '$lib/store/user-settings';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';
Expand All @@ -12,6 +14,9 @@ COMPONENT JS (w/ TS)
// COMPONENT VARIABLES
// ~~~~~~~~~~~~~~~~~~~~~
export let RESPONSE_PROFILE_DATA: REDIS_CACHE_SINGLE_profile_translation;
$: RESPONSE_PROFILE_DATA = $page.data.RESPONSE_PROFILE_DATA;
const dispatch = createEventDispatcher();
// ~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -87,7 +92,7 @@ COMPONENT HTML
color-black-2
"
>
Delete Account ?
{RESPONSE_PROFILE_DATA?.delete_account_title} ?
</p>
<!--
[ℹ] delete account desc. info
Expand All @@ -99,9 +104,7 @@ COMPONENT HTML
m-b-24
"
>
Are you sure that you want to delete your
account? All your data will be removed
permanently!
{RESPONSE_PROFILE_DATA?.delete_account_desc}
</p>
<!--
[ℹ] main widget action
Expand All @@ -124,7 +127,7 @@ COMPONENT HTML
style="width: 100%"
on:click={() => continue_delete_account()}
>
Delete Account
{RESPONSE_PROFILE_DATA?.delete_button}
</button>
<!--
[ℹ] cancel action (btn)
Expand All @@ -137,7 +140,7 @@ COMPONENT HTML
style="width: 100%"
on:click={() => toggle_modal()}
>
Cancel
{RESPONSE_PROFILE_DATA?.cancel_expression}
</button>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions src/lib/components/page/profile/Widget-AccountSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ COMPONENT JS (w/ TS)
dlog(querySnapshot, false);
if (querySnapshot.docs.length > 0) {
valid = false
usernameErrorMsg = 'Username is already in use';
usernameErrorMsg = RESPONSE_PROFILE_DATA?.userame_update_error_msg[0] || 'Username is already in use';
}
// [ℹ] validation [2] - length (min)
if (usernameInput.length < 3) {
valid = false;
usernameErrorMsg = 'Username must be greater than 3 characters';
usernameErrorMsg = RESPONSE_PROFILE_DATA?.userame_update_error_msg[1] || 'Username must be greater than 3 characters';
}
// [ℹ] validation [3] - length (min)
if (usernameInput.length > 15) {
Expand All @@ -263,18 +263,18 @@ COMPONENT JS (w/ TS)
// [ℹ] validation [4] - only-numbers
if (/^\d+$/.test(usernameInput)) {
valid = false;
usernameErrorMsg = 'Username must not contain only numbers';
usernameErrorMsg = RESPONSE_PROFILE_DATA?.userame_update_error_msg[2] || 'Username must not contain only numbers';
};
// [ℹ] validation [5] - has a space
if (/\s/g.test(usernameInput)) {
valid = false;
usernameErrorMsg = 'Username must not contain spaces'
usernameErrorMsg = RESPONSE_PROFILE_DATA?.userame_update_error_msg[3] || 'Username must not contain spaces';
}
// [ℹ] validation [6] - has special char
let format = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/;
if (format.test(usernameInput)) {
valid = false;
usernameErrorMsg = 'Username cant have spaces or special characters'
usernameErrorMsg = RESPONSE_PROFILE_DATA?.userame_update_error_msg[4] || 'Username cant have spaces or special characters';
}
// [ℹ] return;
return valid;
Expand Down Expand Up @@ -534,8 +534,8 @@ COMPONENT HTML
on:click={() => remove_picture()}
>
{!profile_picture_exists
? 'Upload'
: 'Remove'}
? RESPONSE_PROFILE_DATA?.upload
: RESPONSE_PROFILE_DATA?.remove}
</button>
<!--
[ℹ] profile picture input
Expand Down
3 changes: 3 additions & 0 deletions src/lib/models/hasura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,8 @@ export interface BETARENA_HASURA_profile_translations {
export interface Profile_Translation {
name?: string;
save?: string;
remove?: string;
upload?: string;
soon?: string;
author?: string;
scores?: string;
Expand All @@ -1935,4 +1937,5 @@ export interface Profile_Translation {
connect_wallet_title?: string;
delete_account_title?: string;
disconnect_wallet_title?: string;
userame_update_error_msg?: [string, string, string, string, string]
}

0 comments on commit 4a3090b

Please sign in to comment.