Skip to content

Commit

Permalink
feat(RutaConfigUser): Se paso a /users/me (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-T-Smyth authored Oct 14, 2023
1 parent 15cbe56 commit 2c2c4c1
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions client/src/app/(protected)/users/[id]/UserBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type UserBannerProps = {
isLoggedUser: boolean;
};

function EditButton(props: { user: User }) {
function EditButton() {
return (
<Link data-testid={'editButton'} href={`/users/${props.user.id}/edit`}>
<Link data-testid={'editButton'} href={`/users/me`}>
<button className='flex w-fit items-center rounded-md bg-[#2B2D54] p-2 lg:self-end'>
<EditIcon className={'m-2 h-5 w-5 fill-white'} />
<p className={'mr-2 text-lg font-medium text-white'}>Editar perfil</p>
Expand Down Expand Up @@ -194,7 +194,7 @@ export default function UserBanner({
</div>
</div>
<div className='m-10 mt-20 flex justify-center lg:mr-20 lg:mt-10'>
{isLoggedUser && <EditButton user={user} />}
{isLoggedUser && <EditButton />}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { ConfigProfileSection } from '@/app/(protected)/users/[id]/edit/ConfigProfileSection';
import { ConfigProfileSection } from '@/app/(protected)/users/me/ConfigProfileSection';
import Input from '@/components/common/Input';
import React, { useEffect, useState } from 'react';
import { alertTypes } from '@/components/common/Alert';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';

import { ConfigProfileSection } from '@/app/(protected)/users/[id]/edit/ConfigProfileSection';
import { ConfigProfileSection } from '@/app/(protected)/users/me/ConfigProfileSection';
import { TrashCanIcon } from '@/assets/Icons/TrashCanIcon';
import React, { useState } from 'react';
import { User } from '@/types/User';
import DelayedConfirmDialog from '@/app/(protected)/users/[id]/edit/DelayedConfirmDialog';
import DelayedConfirmDialog from '@/app/(protected)/users/me/DelayedConfirmDialog';
import { Logger } from '@/services/Logger';
import { UserService } from '@/services/UserService';
import { signOut } from 'next-auth/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jest.mock('next-auth/react', () => ({
//We want to also mock ApiCommunicator.clientSideEditUser(id)
// eslint-disable-next-line no-unused-vars
const ApiCommunicator =
require('../../../../../services/ApiCommunicator').ApiCommunicator;
require('../../../../services/ApiCommunicator').ApiCommunicator;
jest.mock('../../../services/ApiCommunicator', () => ({
ApiCommunicator: {
clientSideEditUser: jest.fn().mockReturnValue({ ok: true }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Subject } from '@/types/Subject';
import { Career } from '@/types/Career';
import { SocialNetworks } from '@/types/SocialNetworks';
import { useSession } from 'next-auth/react';
import { ConfigProfileSection } from '@/app/(protected)/users/[id]/edit/ConfigProfileSection';
import { ConfigProfileSection } from '@/app/(protected)/users/me/ConfigProfileSection';
import { mustBePhoneNumer, mustBeURLWithUsername } from '@/utils/Pattern';

type PersonalInfoFormData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ApiCommunicator } from '@/services/ApiCommunicator';
import { getServerSession } from 'next-auth';
import { authOptions } from '@/app/api/auth/[...nextauth]/auth';
import { SubjectService } from '@/services/SubjectService';
import { ChangePasswordSection } from '@/app/(protected)/users/[id]/edit/ChangePasswordSection';
import { DeleteUserSection } from '@/app/(protected)/users/[id]/edit/DeleteUserSection';
import { ChangePasswordSection } from '@/app/(protected)/users/me/ChangePasswordSection';
import { DeleteUserSection } from '@/app/(protected)/users/me/DeleteUserSection';

export default async function ConfigProfile() {
const session = await getServerSession(authOptions);
Expand Down
9 changes: 5 additions & 4 deletions client/src/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { signOut } from 'next-auth/react';
import defaultUser from '@/assets/images/default_user.png';
import Link from 'next/link';
import FinderLogoIcon from '@/assets/Icons/FinderLogoIcon';
import { Logger } from '@/services/Logger';

const userNavigation = (user: User) => [
{
Expand All @@ -25,12 +26,12 @@ const userNavigation = (user: User) => [
},
{
name: strings.header.navOptions.editProfile,
href: `/users/${user.id}/edit`,
href: `/users/me`,
},
{
name: strings.header.navOptions.endSession,
href: '#',
onClick: () => signOut().catch((e) => console.log(e)),
onClick: () => signOut().catch(Logger.error),
},
];

Expand All @@ -52,14 +53,14 @@ const userNavigationMobile = (user: User) => [
},
{
name: strings.header.navOptions.editProfile,
href: `/users/${user.id}/edit`,
href: `/users/me`,
icon: <EditIcon className='mr-3 h-4 w-4' />,
},
{
name: strings.header.navOptions.endSession,
href: '#',
icon: <LogOutIcon className='mr-2 h-5 w-5' />,
onClick: () => signOut().catch((e) => console.log(e)),
onClick: () => signOut().catch(Logger.error),
},
];

Expand Down

0 comments on commit 2c2c4c1

Please sign in to comment.