Skip to content

Commit 239ea9d

Browse files
authored
Merge pull request #51 from FSDSTR0225/dev
Dev
2 parents f7d809e + b6ab558 commit 239ea9d

File tree

6 files changed

+45
-30
lines changed

6 files changed

+45
-30
lines changed

src/features/recruiters/pages/DashBoarPage.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ const handleDownloadCoverLetter = async (offerId, userId) => {
9494
{/* En pantallas menores a lg: siempre muestra ListDashBoard */}
9595
<div className="lg:hidden">
9696
<ListDashBoard offerId={offerId}
97+
openChat={openChat}
98+
handleDownloadCoverLetter={handleDownloadCoverLetter}
99+
handleDownloadCV={handleDownloadCV}
97100
skillsOffer={skillsOffer}
98101
lists={lists}
99102
setLists={setLists}
@@ -109,6 +112,9 @@ const handleDownloadCoverLetter = async (offerId, userId) => {
109112
lists={lists}
110113
setLists={setLists}
111114
getCandidates={getCandidates} /> : <RecDashBoar offerId={offerId}
115+
openChat={openChat}
116+
handleDownloadCoverLetter={handleDownloadCoverLetter}
117+
handleDownloadCV={handleDownloadCV}
112118
lists={lists}
113119
setLists={setLists} />}
114120
</div>

src/features/recruiters/pages/OfferInfoPage.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const OfferInfoPage = () => {
8383
const hasApplied =
8484
Array.isArray(offer?.applicants) &&
8585
profile?._id &&
86-
offer?.applicants?.some((applicant) => applicant?.user === profile._id);
86+
offer?.applicants?.some((applicant) => applicant?.user === profile._id || applicant?.user?._id === profile?._id || applicant?.user?.toString() === profile?._id);
8787

8888
const getCandidates = async () => {
8989
const data = await getCandidatesByOfferId(id, localStorage.getItem("token"));
@@ -111,6 +111,8 @@ export const OfferInfoPage = () => {
111111
fetchOffer();
112112
}, [id]);
113113

114+
115+
114116
const handleApplyModal = (e) => {
115117
e.stopPropagation();
116118
if (!token) {
@@ -121,6 +123,11 @@ export const OfferInfoPage = () => {
121123
setIsOpenApplyModal(true);
122124
};
123125

126+
const handleApplySuccess = (updatedOffer) => {
127+
console.log("Offer applied successfully:", updatedOffer);
128+
setOffer(updatedOffer);
129+
};
130+
124131
const colors = {
125132
pending: "bg-blue-500",
126133
reviewed: "bg-purple-500",
@@ -315,6 +322,7 @@ export const OfferInfoPage = () => {
315322
setIsOpen={setIsOpenApplyModal}
316323
token={token}
317324
handleApply={handleApplyModal}
325+
onApplySuccess={handleApplySuccess}
318326
/>
319327
)}
320328
</SectionContainer>

src/layout/Header.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ export const Header = () => {
6363

6464
{/* Panel de notificaciones */}
6565
{profile && notificationsOpen && (
66-
<div className="absolute right-0 mt-2 w-80 max-w-xs bg-neutral-70 shadow-lg rounded-xl z-50">
66+
<div
67+
className={`
68+
absolute z-50 mt-2
69+
w-[95vw] max-w-xs left-1/2 -translate-x-1/2 right-auto
70+
sm:w-80 sm:max-w-xs sm:left-auto sm:right-0 sm:translate-x-0
71+
bg-neutral-70 shadow-lg rounded-xl
72+
`}
73+
>
6774
<div className="flex justify-between items-center px-4 py-3 border-b border-base-200">
6875
<span className="font-semibold text-base-content">Notificaciones</span>
6976
<button
@@ -82,9 +89,9 @@ export const Header = () => {
8289
.map((notif, index) => (
8390
<div
8491
key={notif._id || `${notif.senderName}-${notif.type}-${index}`}
85-
className="w-full bg-neutral-60 text-base-content shadow-md rounded-md p-3"
92+
className="w-full bg-neutral-60 text-base-content shadow-md rounded-md p-3 break-words"
8693
>
87-
<div className="text-sm font-medium">
94+
<div className="text-sm font-medium break-words">
8895
{getNotificationText(notif)}
8996
</div>
9097
<span className="text-xs opacity-60 block mt-1">

src/layout/chat/Widget.jsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ import { ChatContext } from "./context/ChatContext";
66

77
export function Widget() {
88
// const [isOpen, setIsOpen] = useState(false);
9-
const { profile, token } = useContext(AuthContext);
9+
const { profile, token, notifications } = useContext(AuthContext);
1010
const {toggleChat, isOpen} = useContext(ChatContext);
11-
11+
const unreadChats = notifications.filter(n => n.type === 1).length;
1212
// const toggleChat = () => {
1313
// setIsOpen(!isOpen);
1414
// };
1515

16-
return (
16+
return (
1717
<>
1818
{token && (
1919
<div className="fixed bottom-8 right-8 z-50">
2020
<div className="relative">
2121
{/* Panel */}
2222
<div
23-
className={` z-60
24-
absolute -bottom-4 -right-6 sm:bottom-16 sm:right-10 w-[95dvw] h-[95dvh] md:right-8 sm:w-[320px] sm:h-[500px]
23+
className={`z-60
24+
absolute -bottom-4 -right-6 sm:bottom-16 sm:right-10 w-[95dvw] h-[95dvh] md:right-8 sm:w-[320px] sm:h-[500px]
2525
bg-neutral-70 rounded-2xl shadow-2xl border border-neutral-60 overflow-hidden
2626
transform origin-bottom-right
2727
transition duration-500 ease-in-out
2828
${isOpen ? 'scale-100 opacity-100' : 'scale-0 opacity-0 pointer-events-none'}
2929
`}
3030
style={{
31-
boxShadow: '0 50px 50px rgba(0, 0, 0, 0.8)' // más profunda
31+
boxShadow: '0 50px 50px rgba(0, 0, 0, 0.8)'
3232
}}
3333
>
3434
<ChatPanel onClose={toggleChat} user={profile} />
@@ -42,9 +42,14 @@ export function Widget() {
4242
}}
4343
className="
4444
w-14 h-14 rounded-full text-white flex items-center justify-center shadow-2xl hover:brightness-90
45-
transition transform active:scale-90 duration-150 ease-out"
45+
transition transform active:scale-90 duration-150 ease-out relative"
4646
>
4747
<PiChat size={28} />
48+
{unreadChats > 0 && (
49+
<span className="absolute -top-2 -right-2 bg-red-500 text-white text-xs px-2 py-0.5 rounded-full animate-pulse min-w-[22px] text-center">
50+
{unreadChats}
51+
</span>
52+
)}
4853
</button>
4954
</div>
5055
</div>

src/layout/chat/components/ChatScreen.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export const ChatScreen = ({ onClose, messages, messageEndRef, userSelected, onl
3535
key={message._id}
3636
className={`chat ${message.senderId === profile._id ? "chat-end" : "chat-start"} `}
3737
ref={messageEndRef}>
38-
<div className="chat-image avatar border rounded-full border-neutral-50">
38+
<div className="chat-image ">
3939
{
4040
message.senderId === profile._id
41-
? <AvatarImage user={profile} width={8} /> || "/avatar.png"
41+
? <AvatarImage classProps={""} user={profile} width={8} /> || "/avatar.png"
4242
: <AvatarImage user={userSelected} width={8} /> || "/avatar.png"
4343
}
4444
</div>

src/layout/components/Navbar.jsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link } from "react-router"
22
import logo from '../../assets/CodepplyLogo.svg'
3-
import { PiBriefcase, PiStack, PiUsers } from "react-icons/pi"
3+
import { PiBriefcase, PiList, PiStack, PiUsers } from "react-icons/pi"
44
import favicon from '../../assets/CodepplyFly.svg'
55

66

@@ -13,34 +13,23 @@ export const Navbar = () => {
1313
aria-label='open sidebar'
1414
className='btn btn-square btn-ghost'
1515
>
16-
<svg
17-
xmlns='http://www.w3.org/2000/svg'
18-
fill='none'
19-
viewBox='0 0 24 24'
20-
className='inline-block h-6 w-6 stroke-current'
21-
>
22-
<path
23-
strokeLinecap='round'
24-
strokeLinejoin='round'
25-
strokeWidth='2'
26-
d='M4 6h16M4 12h16M4 18h16'
27-
></path>
28-
</svg>
16+
<PiList className="text-3xl"/>
17+
2918
</label>
3019
</div>
3120
<Link
3221
to={"/"}
33-
className='mr-4 pr-4 flex items-center'
22+
className='mr-4 flex items-center'
3423
>
3524
<img
3625
src={logo}
3726
alt='Codepply Logo'
38-
className='h-6 ml-3 sm:hidden md:block '
27+
className='h-6 hidden md:block '
3928
/>
4029
<img
4130
src={favicon}
4231
alt='Codepply Logo'
43-
className='h-6 ml-3 hidden sm:block md:hidden'
32+
className='h-6 mx-4 sm:block md:hidden'
4433
/>
4534
</Link>
4635
<div className='hidden flex-none sm:flex'>

0 commit comments

Comments
 (0)