diff --git a/app/modules/auth/components/CompleteAccount.vue b/app/modules/auth/components/CompleteAccount.vue index da5fe487..8ca9e949 100644 --- a/app/modules/auth/components/CompleteAccount.vue +++ b/app/modules/auth/components/CompleteAccount.vue @@ -26,11 +26,17 @@ +
{ +const onInterestsNext = (interests: string[]) => { profileData.interests = interests showInterests.value = false - showLoading.value = true - - enableUserQuery.value = true + showWhoToFollow.value = true } const onInterestsSkip = () => { profileData.interests = [] showInterests.value = false - showLoading.value = true - enableUserQuery.value = true + showWhoToFollow.value = true } const onInterestsBack = () => { @@ -185,6 +190,18 @@ const onInterestsBack = () => { showLanguage.value = true } +// Who to Follow handlers +const onWhoToFollowFinish = (followedUsers: string[]) => { + showWhoToFollow.value = false + showLoading.value = true + enableUserQuery.value = true +} + +const onWhoToFollowBack = () => { + showWhoToFollow.value = false + showInterests.value = true +} + const onClose = () => { router.push('/') } diff --git a/app/modules/auth/components/subComponents/CompleteAccountComponents/Interests.vue b/app/modules/auth/components/subComponents/CompleteAccountComponents/Interests.vue index 19401998..25083e59 100644 --- a/app/modules/auth/components/subComponents/CompleteAccountComponents/Interests.vue +++ b/app/modules/auth/components/subComponents/CompleteAccountComponents/Interests.vue @@ -3,33 +3,39 @@ :isOpen="true" @close="$emit('close')" :hasCloseButton="false" - contentClass="sm:max-w-xl w-full" + contentClass="sm:max-w-2xl w-full" :headerClass="isArabic ? 'absolute top-4 right-4 z-10 bg-transparent p-0' : 'absolute top-4 left-4 z-10 bg-transparent p-0'" - slotClass="py-2 px-10 sm:px-10 md:px-12 lg:px-14" + slotClass="pt-4 px-8 pb-8 sm:pt-6 sm:px-10 sm:pb-10" @back="$emit('back')" :hasBackButton="true" > - - - - + +
+ +
-

{{ $t('auth.interests.title') }}

-

{{ $t('auth.interests.info') }}

+

{{ $t('auth.interests.title') }}

+

{{ $t('auth.interests.info') }}

+ + +
+ {{ errorMessage }} +
-
-
+
+
- -

- {{ selectedInterests.length }} {{ $t('auth.common.selectedSuffix') }} - - ({{ 3 - selectedInterests.length }} {{ $t('auth.common.neededMoreSuffix') }}) - -

- - - - - - + +
+ +

+ {{ selectedInterests.length }} {{ $t('auth.interests.selected') || 'of 1 selected' }} +

+ + + +
@@ -132,10 +129,11 @@ const toggleInterest = (id: string) => { const interestsMutation = useUpdateInterestsMutation( (data) => { + console.log('Interests update success:', data) isSubmitting.value = false loading.value = false errorMessage.value = '' - emit('finish', selectedInterests.value) + emit('next', selectedInterests.value) }, (error) => { console.error('Interests update error:', error) @@ -147,11 +145,14 @@ const interestsMutation = useUpdateInterestsMutation( ) const onNext = () => { - if (selectedInterests.value.length >= 3 && !isSubmitting.value) { + if (selectedInterests.value.length >= 1 && !isSubmitting.value) { + console.log('Submitting interests:', selectedInterests.value) isSubmitting.value = true loading.value = true + errorMessage.value = '' // Clear previous errors // categoryIds are the selected interest ids const categoryIds = selectedInterests.value.map(id => parseInt(id)) + console.log('Category IDs:', categoryIds) interestsMutation.mutate({ categoryIds }) } } diff --git a/app/modules/auth/components/subComponents/CompleteAccountComponents/Language.vue b/app/modules/auth/components/subComponents/CompleteAccountComponents/Language.vue index e3907d06..6228345a 100644 --- a/app/modules/auth/components/subComponents/CompleteAccountComponents/Language.vue +++ b/app/modules/auth/components/subComponents/CompleteAccountComponents/Language.vue @@ -7,46 +7,54 @@ :hasBackButton="true" contentClass="max-w-lg sm:max-w-xl w-full" headerClass="" - slotClass="p-8 sm:p-10 md:p-14 lg:p-20" + slotClass="pt-4 px-8 pb-8 sm:pt-6 sm:px-10 sm:pb-10" > - - - - + +
+ +
-

+

{{ $t('auth.language.title') }}

-

{{ $t('auth.language.info') }}

+

{{ $t('auth.language.info') }}

-
+ +
@@ -54,11 +62,11 @@ - - - @@ -94,6 +93,8 @@ const isArabic = computed(() => locale.value === 'ar') const errorMessage = ref('') const isSubmitting = ref(false) const loading = ref(false) +const showAllLanguages = ref(false) +const languagesToShow = 2 interface Language { code: string @@ -102,10 +103,17 @@ interface Language { } const languages: Language[] = [ - { code: 'en', name: 'English', nativeName: 'English' }, { code: 'ar', name: 'Arabic', nativeName: 'العربية' }, + { code: 'en', name: 'English', nativeName: 'English' }, ] +const displayedLanguages = computed(() => { + if (showAllLanguages.value) { + return languages + } + return languages.slice(0, languagesToShow) +}) + // Use v-model for selected language const selectedLanguage = defineModel('selectedLanguage', { default: null }) diff --git a/app/modules/auth/components/subComponents/CompleteAccountComponents/ProfilePicture.vue b/app/modules/auth/components/subComponents/CompleteAccountComponents/ProfilePicture.vue index 0773121c..58ae2c20 100644 --- a/app/modules/auth/components/subComponents/CompleteAccountComponents/ProfilePicture.vue +++ b/app/modules/auth/components/subComponents/CompleteAccountComponents/ProfilePicture.vue @@ -9,16 +9,18 @@ ? 'absolute top-4 right-4 z-10 bg-transparent p-0' : 'absolute top-4 left-4 z-10 bg-transparent p-0' " - slotClass="p-8 sm:p-10 md:p-14 lg:p-20" + slotClass="pt-4 px-8 pb-8 sm:pt-6 sm:px-10 sm:pb-10" > - - + +
+ +
-

+

{{ $t('auth.profilePicture.title') }}

-

+

{{ $t('auth.profilePicture.info') }}

diff --git a/app/modules/auth/components/subComponents/CompleteAccountComponents/Username.vue b/app/modules/auth/components/subComponents/CompleteAccountComponents/Username.vue index b46dd109..a08dced2 100644 --- a/app/modules/auth/components/subComponents/CompleteAccountComponents/Username.vue +++ b/app/modules/auth/components/subComponents/CompleteAccountComponents/Username.vue @@ -7,68 +7,87 @@ :hasBackButton="true" contentClass="max-w-lg sm:max-w-xl w-full" headerClass="" - slotClass="p-8 sm:p-10 md:p-14 lg:p-20" + slotClass="pt-4 px-8 pb-8 sm:pt-6 sm:px-10 sm:pb-10" > - - - - + +
+ +
-

{{ $t('auth.username.title') }}

-

{{ $t('auth.username.info') }}

+

{{ $t('auth.username.title') }}

+

{{ $t('auth.username.info') }}

+
- @ + + + +
-
-

+

+

{{ username?.length || 0 }}/20

+
+
+

{{ errorMessage }}

-

- {{ $t('auth.username.available') }} -

-

.

-

{{ username?.length || 0 }}/25

-

{{ $t('auth.username.recommendations') }}

-
    +

    {{ $t('auth.username.recommendations') }}

    +
    • - {{ suggestion }} + @{{ suggestion }}
    + + +
@@ -121,6 +140,8 @@ const debouncedUsername = useDebounce(username, 500) const errorMessage = ref('') const isSubmitting = ref(false) const loading = ref(false) +const showAllRecommendations = ref(false) +const recommendationsToShow = 2 // Show 2 recommendations initially const emit = defineEmits<{ (e: 'next', username: string): void @@ -168,8 +189,8 @@ const validateUsername = (value: string | null) => { return } - if (value.length > 25){ - errorMessage.value = 'Username must be shorter than 25 characters' + if (value.length > 20){ + errorMessage.value = 'Username must be shorter than 20 characters' return } @@ -198,6 +219,14 @@ const isValid = computed(() => { return username.value && username.value.length >= 3 && !errorMessage.value }) +const displayedRecommendations = computed(() => { + if (!props.Recommendations) return [] + if (showAllRecommendations.value) { + return props.Recommendations + } + return props.Recommendations.slice(0, recommendationsToShow) +}) + const usernameMutation = useUpdateUsernameMutation( props.Recommendations[0], (data) => { diff --git a/app/modules/auth/components/subComponents/CompleteAccountComponents/WhoToFollow.vue b/app/modules/auth/components/subComponents/CompleteAccountComponents/WhoToFollow.vue new file mode 100644 index 00000000..664bc2ce --- /dev/null +++ b/app/modules/auth/components/subComponents/CompleteAccountComponents/WhoToFollow.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/app/modules/auth/components/subComponents/signupComponents/FinalRegister.vue b/app/modules/auth/components/subComponents/signupComponents/FinalRegister.vue index ca8ab5c0..067089a4 100644 --- a/app/modules/auth/components/subComponents/signupComponents/FinalRegister.vue +++ b/app/modules/auth/components/subComponents/signupComponents/FinalRegister.vue @@ -118,7 +118,8 @@ const clearPasswordError = () => { passwordError.value = '' errorMessage.value = '' } - +const config = useRuntimeConfig() +const isTest = config.public.etest?.toString() === 'true' const onNext = () => { // Validate before submitting if (!validatePasswordField()) { @@ -127,6 +128,15 @@ const onNext = () => { errorMessage.value = '' // Clear previous errors loading.value = true + if (!props.username || isTest) { + registerMutation.mutate({ + Email: props.Email, + Username: `user${Date.now()}`, + Password: password.value, + Language: 'en', + }) + return + } registerMutation.mutate({ Email: props.Email, Username: props.username, diff --git a/i18n/locales/ar.json b/i18n/locales/ar.json index 25d235e1..6494e602 100644 --- a/i18n/locales/ar.json +++ b/i18n/locales/ar.json @@ -93,9 +93,12 @@ "username": { "title": "ماذا يجب أن نسميك؟", "info": "اسم المستخدم الخاص بك فريد. يمكنك دائماً تغييره لاحقاً", + "label": "اسم المستخدم", "placeholder": "اسم المستخدم", "available": "متاح!", - "recommendations": "أسماء المستخدمين الموصى بها" + "recommendations": "أسماء المستخدمين الموصى بها", + "showMore": "عرض المزيد", + "showLess": "إظهار أقل" }, "profilePicture": { "title": "اختر صورة ملفك الشخصي", @@ -155,12 +158,21 @@ "passwordMismatch": "كلمتا المرور غير متطابقتين." }, "language": { - "title": "اختر لغتك", - "info": "سيساعدنا ذلك على تخصيص تجربتك في Yapper" + "title": "اختر اللغة", + "info": "ستتمكن من رؤية المنشورات والأشخاص والمواضيع الرائجة بأي لغة تختارها.", + "showMore": "عرض المزيد" }, "interests": { - "title": "ما المجالات التي تهمك؟", - "info": "اختر 3 اهتمامات على الأقل لمساعدتنا في تخصيص محتواك" + "title": "ماذا تريد أن ترى على Yapper؟", + "info": "اختر ما يعجبك، وسنخصص تجربتك في Yapper مع المزيد مما تهتم به.", + "selected": "من 1 تم الاختيار" + }, + "whoToFollow": { + "title": "لا تفوت", + "info": "عندما تتابع شخصاً ما، سترى منشوراته في خطك الزمني. ستحصل أيضاً على توصيات أكثر صلة.", + "requirement": "تابع حساب واحد أو أكثر", + "follow": "متابعة", + "following": "متابَع" }, "validation": { "emailRequired": "البريد الإلكتروني مطلوب", diff --git a/i18n/locales/en.json b/i18n/locales/en.json index bec21e08..fa4eb633 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -117,9 +117,12 @@ "username": { "title": "What should we call you?", "info": "Your username is unique. You can always change it later.", + "label": "Username", "placeholder": "username", "available": "Available!", - "recommendations": "Recommended usernames:" + "recommendations": "Recommended usernames:", + "showMore": "Show more", + "showLess": "Show less" }, "profilePicture": { "title": "Pick a profile picture", @@ -155,12 +158,21 @@ "passwordMismatch": "Passwords do not match." }, "language": { - "title": "Select your language", - "info": "This will help us personalize your Yapper experience." + "title": "Select language", + "info": "You'll be able to see posts, people, and trends in any languages you choose.", + "showMore": "Show more" }, "interests": { - "title": "What are you interested in?", - "info": "Select at least 3 interests to help us tailor your feed." + "title": "What do you want to see on Yapper?", + "info": "Choose what you like, and we'll customize your Yapper experience with more of what you're interested in.", + "selected": "of 1 selected" + }, + "whoToFollow": { + "title": "Don't miss out", + "info": "When you follow someone, you'll see their posts in your Timeline. You'll also get more relevant recommendations.", + "requirement": "Follow 1 or more accounts", + "follow": "Follow", + "following": "Following" }, "validation": { "emailRequired": "Email is required",