Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-eof committed May 13, 2023
1 parent 232828d commit 4a05850
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ password: Micr@J@bs

![screenshot](screenshot1.png)

![screenshot](screenshot2.png)

For any information, feel free to [contact me](http:https://andre-i.eu/#contactme).
Binary file added screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,7 @@ export default function Main() {
/>
<Route path="/register" element={<Register />} />
<Route path="/rooms" element={<Conversations />} />
<Route
path="/room/:roomId/username/:username"
element={<JobInfoSidebar />}
/>
<Route path="/rooms/:roomId" element={<JobInfoSidebar />} />
<Route path="/authenticate" element={<Login />} />
<Route
path="/view/:scope/jobId/:id"
Expand Down
2 changes: 1 addition & 1 deletion src/components/job/ViewJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function ViewOfferRequest({}: Props) {
}
GenericApiService.get<Room>(`api/v1/room/jobId/${job.id}`).then(
(room: Room) => {
navigate(`/room/${room?.id}/username/${job.author?.username}`);
navigate(`/rooms/${room?.id}`);
}
);
}
Expand Down
19 changes: 10 additions & 9 deletions src/components/message/Conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,24 @@ export default function Conversations() {
}
);
}, []);

const navigate = useNavigate();
return (
<>
<Title title={'Conversations'} />
{rooms && rooms.map((room, idx) => <RoomItem key={idx} room={room} />)}
{rooms &&
rooms.map((room, idx) => (
<RoomItem navigate={navigate} key={idx} room={room} />
))}
</>
);
}

interface RoomItemProps {
room: Room;
navigate: (path: string) => void;
}

function RoomItem({ room }: RoomItemProps) {
function RoomItem({ room, navigate }: RoomItemProps) {
const [roomPicture] = useState<string>(
JobService.getImageLink(room.pictureName)
);
Expand All @@ -48,12 +52,9 @@ function RoomItem({ room }: RoomItemProps) {
(participant) => !UserService.isSameUsername(participant)
)[0]
);
const navigate = useNavigate();

const goToConversation = (room: Room) => {
const participant = room.participants.filter(
(part) => !UserService.isSameUsername(part)
)[0];
navigate(`/room/${room.id}/username/${participant}`);
navigate(`/rooms/${room.id}`);
};
return (
<Card
Expand All @@ -66,7 +67,7 @@ function RoomItem({ room }: RoomItemProps) {
objectFit="cover"
maxW={{ base: '100%', sm: '50px' }}
src={roomPicture}
alt="Caffe Latte"
alt="Room picture"
/>

<Stack>
Expand Down
1 change: 1 addition & 0 deletions src/components/message/JobInfoSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Title from '../job/Header';
export default function JobInfoSidebar() {
const { roomId } = useParams();
const [job, setJob] = useState<Job>();

useEffect(() => {
GenericApiService.get<Job>(`api/v1/job/private/roomId/${roomId}`).then(
(job: Job) => {
Expand Down
1 change: 0 additions & 1 deletion src/interceptors/LoginInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const customInterceptor = (navigate: any) => {
return Promise.reject(error);
}
);
// return Promise.resolve(data);
} else {
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
Expand Down

0 comments on commit 4a05850

Please sign in to comment.