Skip to content

Commit

Permalink
update profile view
Browse files Browse the repository at this point in the history
  • Loading branch information
sandygudie committed Jan 14, 2024
1 parent 343d5d2 commit 00cf569
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 30 deletions.
36 changes: 19 additions & 17 deletions client/src/components/LinkItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ defineProps<{
</script>

<template>
<div>
<div class="overflow-y-scroll md:h-[70vh] md:pr-6">
<div>
<h1 class="font-extrabold text-2xl text-gray-200">Customize your links</h1>
<p class="text-xs text-gray-200">
Add/edit/remove links below and then share all your profiles with the world
<p class="text-sm text-gray-200">
Add/edit/remove links below and then share all your profiles with the world.
</p>
</div>
<button
Expand All @@ -28,7 +28,7 @@ defineProps<{
propitems.devLinks.length >= 5
? 'text-purple-300/20 border-purple-300/20'
: 'text-purple-300 border-purple-300'
} my-8 border rounded-lg w-full py-1.5 hover:bg-hover-purle`"
} my-6 border rounded-lg w-full py-1.5 hover:bg-hover-purle`"
>
Add new link
</button>
Expand Down Expand Up @@ -57,17 +57,19 @@ defineProps<{
</div>
</div>

<div class="mt-8 bg-white">
<hr class="w-full border-gray-400" />
<div class="text-right my-2 mx-6">
<input
value="Save"
type="submit"
:disabled="propitems.devLinks.length <= 0 || propitems.devLinks.length >= 5"
:class="`${
propitems.devLinks.length < 5 && propitems.devLinks.length >0? 'bg-purple-300' : 'bg-purple-300/20'
} px-4 py-2 text-sm text-bold cursor-pointer text-white rounded-lg`"
/>
</div>
</div>
<div class="mt-4 bg-white">
<hr class="w-full border-gray-400" />
<div class="text-right my-2 mx-6">
<input
value="Save"
type="submit"
:disabled="propitems.devLinks.length <= 0 || propitems.devLinks.length >= 5"
:class="`${
propitems.devLinks.length < 5 && propitems.devLinks.length > 0
? 'bg-purple-300'
: 'bg-purple-300/20'
} px-4 py-2 text-sm text-bold cursor-pointer text-white rounded-lg`"
/>
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion client/src/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function copyTextToClipboard() {
<img
v-if="updatedLinks.profilepic"
:src="updatedLinks.profilepic"
class="w-20 mx-auto h-20 rounded-full"
class="w-20 mx-auto h-20 rounded-full border-[1px] border-solid border-gray-400"
alt="profile-upload"
/>
<div v-else class="bg-gray-400 rounded-full w-20 mx-auto h-20"></div>
Expand Down
21 changes: 17 additions & 4 deletions client/src/components/Profile.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<script setup lang="ts">
import {logOut} from '@/utilis'
defineProps<{
handleFirstNameChange: (e: any) => void
handleLastNameChange: (e: any) => void
uploadProfileImage: (e: any) => void
profileLinks: {} | any
}>()
const logoutCurentUser=() =>{
logOut()
}
</script>

<template>
<div class="text-gray-200">
<div class="">
<div>
<h1 class="font-extraBold text-xl">Profile Details</h1>
<p class="text-sm text-gray-200">
Add your details to create a personal touch to your profile
Add your details to create a personal touch to your profile.
</p>
</div>
<div
Expand All @@ -23,7 +28,7 @@ defineProps<{
<img
v-if="profileLinks.profilepic"
:src="profileLinks.profilepic"
class="w-full h-36 object-fit rounded-full"
class="w-full h-36 object-fit rounded-full border-[1px] border-solid border-gray-400"
alt="profile-upload"
/>
<img
Expand Down Expand Up @@ -78,7 +83,7 @@ defineProps<{
required
:value="profileLinks.lastname"
type="text"
class="focus:border-purple-300 border border-solid border-[1px] outline-none rounded-lg px-4 py-3 max-w-48 w-full md:w-10/12"
class="focus:border-purple-300 border border-solid border-[1px] outline-none rounded-lg px-4 py-3 max-w-48 w-full md:w-10/12"
/>
</div>
<div class="md:flex justify-between items-center">
Expand All @@ -91,5 +96,13 @@ defineProps<{
/>
</div>
</div>
<div class="my-6 w-11/12">
<button
:onclick="logoutCurentUser"
class="bg-red/80 hover:bg-red text-white font-medium rounded-lg py-2 px-6"
>
Log out
</button>
</div>
</div>
</template>
6 changes: 3 additions & 3 deletions client/src/components/icons/LogoFull.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 150 40"
width="180"
height="30"
viewBox="0 0 220 40"
width="170"
height="40"
fill="currentColor"
xmlns:v="https://vecta.io/nano"
>
Expand Down
4 changes: 4 additions & 0 deletions client/src/utilis/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ export async function googleLogin(payload: any) {
const response = await makeApiCall('/auth/google', 'post', payload)
return response
}




2 changes: 1 addition & 1 deletion client/src/utilis/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function makeApiCall<T = any>(
return data
} catch (error: any) {
if (error.response) {
console.log(error.response)

if (error.response.status === 403 || error.response.status === 401) {
localStorage.removeItem(TOKEN_KEY)
localStorage.removeItem(USERID)
Expand Down
6 changes: 6 additions & 0 deletions client/src/utilis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ export function setToken(token: string) {
export function removeDuplicates(arr: number[]) {
return arr.filter((item, index) => arr.indexOf(item) === index)
}

export async function logOut() {
localStorage.removeItem(TOKEN_KEY)
localStorage.removeItem(USERID)
window.location.replace('/login')
}
7 changes: 3 additions & 4 deletions client/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const handleLinkChange = (event: any, index: number) => {
</span>

<div v-else class="h-full md:fixed w-full">
<div class="h-full md:p-6 bg-gray-100" v-if="isDisplay === 'editor'">
<div class="h-full bg-gray-100" v-if="isDisplay === 'editor'">
<Header :toggledisplay="toggledisplay" :toggleActive="toggleActive" :isActive="isActive" />
<main class="lg:flex justify-between gap-6 mt-6 h-[90vh]">
<div
Expand Down Expand Up @@ -197,7 +197,6 @@ const handleLinkChange = (event: any, index: number) => {
class="w-3"
:src="`/assets/icons/icon-link-boxes/icon-${item.name.toLowerCase()}-link-box.svg`"
/>

<p class="text-sm">{{ item.name }}</p>
</span>
<span><ArrowIcon class="text-sm fill-white" /></span>
Expand All @@ -221,7 +220,7 @@ const handleLinkChange = (event: any, index: number) => {
</div>
<form
@submit.prevent="handleSubmit"
class="w-full lg:w-7/12 relative bg-white rounded-lg px-4 md:px-6 pt-6 pb-24 overflow-y-scroll"
class="w-full lg:w-7/12 relative bg-white rounded-lg px-4 md:pl-6 pt-6 pb-6 overflow-y-scroll"
>
<Links
v-if="isActive === 'links'"
Expand All @@ -245,7 +244,7 @@ const handleLinkChange = (event: any, index: number) => {
</main>
</div>
<Preview
:shareId="shareId"
:shareId="shareId"
:toggledisplay="toggledisplay"
:updatedLinks="updatedLinks"
v-else-if="isDisplay === 'preview'"
Expand Down

0 comments on commit 00cf569

Please sign in to comment.