@@ -2,37 +2,18 @@ import { Briefcase, PencilLine, UserRound } from "lucide-react";
2
2
3
3
import { useState } from "react" ;
4
4
5
- import { api } from "~/lib/api" ;
6
-
7
- import { useAppStore } from "~/store/appStore" ;
8
- import { useCoverLettersStore } from "~/store/coverLettersStore" ;
9
- import { useInterviewStore } from "~/store/interviewStore" ;
10
- import { useTestStore } from "~/store/testStore" ;
5
+ import { type ApplicationData } from "~/types/types" ;
11
6
12
7
import ServiceLinks from "./ServiceLinks" ;
13
8
import Title from "./Title" ;
14
9
import EditApplicationModal from "./modals/EditApplicationModal" ;
15
- import { ApplicationDetailsSkeleton } from "./skeletons" ;
16
10
17
- const ApplicationSideBar = ( { applicationId } : { applicationId : string } ) => {
11
+ const ApplicationSideBar = ( {
12
+ application,
13
+ } : {
14
+ application : ApplicationData ;
15
+ } ) => {
18
16
const [ isEditApplicationOpen , setIsEditApplicationOpen ] = useState ( false ) ;
19
- const {
20
- applicationId : storeApplicationId ,
21
- setApplicationID : setStoreApplicationID ,
22
- } = useAppStore ( ( state ) => state ) ;
23
- const resetCoverLetters = useCoverLettersStore ( ( state ) => state . reset ) ;
24
- const resetTest = useTestStore ( ( state ) => state . resetTest ) ;
25
- const resetInterview = useInterviewStore ( ( state ) => state . resetInterview ) ;
26
-
27
- if ( applicationId !== storeApplicationId ) {
28
- resetCoverLetters ( ) ;
29
- resetTest ( ) ;
30
- resetInterview ( ) ;
31
- setStoreApplicationID ( applicationId ) ;
32
- }
33
-
34
- const { data : application , isFetching : isLoading } =
35
- api . application . get . useQuery ( { id : applicationId } ) ;
36
17
37
18
return (
38
19
< >
@@ -44,49 +25,48 @@ const ApplicationSideBar = ({ applicationId }: { applicationId: string }) => {
44
25
/>
45
26
) }
46
27
< Title title = "Application" type = "section" />
47
- { isLoading && < ApplicationDetailsSkeleton /> }
48
- { application && ! isLoading && (
49
- < div className = "space-y-2" >
50
- { /* Job Details */ }
51
- < div className = "flex gap-x-4 items-center text-xl" >
52
- < Briefcase className = "w-8 h-8" />
53
- < div >
54
- < p > { application . title } </ p >
55
- { application . companyName && < p > @{ application . companyName } </ p > }
56
- </ div >
28
+ { /* {isLoading && <ApplicationDetailsSkeleton />} */ }
29
+ { /* {application && !isLoading && ( */ }
30
+ < div className = "space-y-2" >
31
+ { /* Job Details */ }
32
+ < div className = "flex gap-x-4 items-center text-xl" >
33
+ < Briefcase className = "w-8 h-8" />
34
+ < div >
35
+ < p > { application . title } </ p >
36
+ { application . companyName && < p > @{ application . companyName } </ p > }
57
37
</ div >
58
- { /* Applicant Details */ }
59
- < div className = "flex gap-x-4 items-center text-xl" >
60
- < UserRound className = "w-8 h-8" />
61
- < div >
62
- < p >
63
- { application . applicant . firstName } { " " }
64
- { application . applicant . lastName }
65
- </ p >
66
- < p > { application . applicant . jobTitle } </ p >
67
- </ div >
38
+ </ div >
39
+ { /* Applicant Details */ }
40
+ < div className = "flex gap-x-4 items-center text-xl" >
41
+ < UserRound className = "w-8 h-8" />
42
+ < div >
43
+ < p >
44
+ { application . applicant . firstName } { application . applicant . lastName }
45
+ </ p >
46
+ < p > { application . applicant . jobTitle } </ p >
68
47
</ div >
48
+ </ div >
69
49
70
- { /* Edit Application Link */ }
71
- < div className = "flex justify-end" >
72
- < button
73
- aria-label = "Edit Application"
74
- className = "font-bold uppercase text-secondary flex gap-x-2 items-center hover:underline underline-offset-2"
75
- onClick = { ( ) => setIsEditApplicationOpen ( true ) }
76
- >
77
- < PencilLine className = "h-8 w-8" />
78
- Edit
79
- </ button >
80
- </ div >
50
+ { /* Edit Application Link */ }
51
+ < div className = "flex justify-end" >
52
+ < button
53
+ aria-label = "Edit Application"
54
+ className = "font-bold uppercase text-secondary flex gap-x-2 items-center hover:underline underline-offset-2"
55
+ onClick = { ( ) => setIsEditApplicationOpen ( true ) }
56
+ >
57
+ < PencilLine className = "h-8 w-8" />
58
+ Edit
59
+ </ button >
60
+ </ div >
81
61
82
- { /* Divider */ }
83
- < div className = "divider" />
62
+ { /* Divider */ }
63
+ < div className = "divider" />
84
64
85
- { /* Link to services */ }
86
- { /* <Title title="I neeed ..." type="subsection" /> */ }
87
- < ServiceLinks applicationId = { application . id } />
88
- </ div >
89
- ) }
65
+ { /* Link to services */ }
66
+ { /* <Title title="I need ..." type="subsection" /> */ }
67
+ < ServiceLinks applicationId = { application . id } />
68
+ </ div >
69
+ { /* )} */ }
90
70
</ >
91
71
) ;
92
72
} ;
0 commit comments