Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat backend integration #384

Merged
merged 27 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
17001e8
add: notion component
VladStashevski Dec 1, 2023
21d62e3
add: getAPI chats, message
VladStashevski Dec 1, 2023
16f3749
Merge branch 'main' into chat-backend-integration
VladStashevski Dec 8, 2023
a662465
Update getChats.ts
VladStashevski Dec 8, 2023
6694e83
add recordid
orby-tech Dec 8, 2023
fd2cf3d
add ids pickers
orby-tech Dec 8, 2023
7252e3f
Merge branch 'main' of github.com:roll-over/unknown-interview into ch…
orby-tech Dec 8, 2023
ad9ebca
remove faker on match
orby-tech Dec 8, 2023
84321f5
refactoring chats and messages
VladStashevski Dec 18, 2023
9ce3339
refactoring sendMessage
VladStashevski Dec 18, 2023
8d25b72
Merge branch 'main' into chat-backend-integration
VladStashevski Dec 18, 2023
42153b5
refactoring chats and messages
VladStashevski Dec 19, 2023
e82d3f9
fix aria-current
VladStashevski Dec 19, 2023
0f9c699
fix formatTime
VladStashevski Dec 19, 2023
da33f61
fix format
VladStashevski Dec 19, 2023
0ddec00
fix style
VladStashevski Dec 19, 2023
52a1a35
feat: add keydown-event enter + fix scroll chatBottom
VladStashevski Dec 20, 2023
dd5a3a8
fix scroll chatBottom behavior
VladStashevski Dec 20, 2023
faa47d8
fix route
VladStashevski Dec 22, 2023
b951990
remove chatNodes
VladStashevski Dec 24, 2023
63777f3
fix route
VladStashevski Dec 24, 2023
dc8ddd5
fix code
VladStashevski Dec 24, 2023
d24715e
Merge branch 'main' into chat-backend-integration
VladStashevski Dec 27, 2023
229d478
refactor: notes block
VladStashevski Dec 28, 2023
94aee79
feat: notes backend-integration + fix bug
VladStashevski Dec 29, 2023
cd42026
refactoring + fix
VladStashevski Jan 2, 2024
fc2af66
refactor: notes + fix bugs
VladStashevski Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 87 additions & 24 deletions frontend/src/lib/components/header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,46 @@
import { createQuery } from '@tanstack/svelte-query';
import { showLogoutModal } from './LogoutModal.svelte';
import LightSwitch from '../../utils/LightSwitch/LightSwitch.svelte';
// import { page } from '$app/stores';

$: userInfoGet = createGetQuery('/api/v1/auth/user_info');
$: userInfo = createQuery({
queryKey: userInfoGet.key,
queryFn: () => userInfoGet.runQuery()
});

$: userRecordsGet = createGetQuery('/api/v1/users/records');
$: userRecordsQuery = createQuery({
queryKey: userRecordsGet.key,
queryFn() {
return userRecordsGet.runQuery();
},
select(res) {
return res.data || null;
}
});

const navCreatePopup: PopupSettings = {
event: 'click',
target: 'nav-create-popup',
placement: 'bottom'
};
const navProfilePopup: PopupSettings = {

const modalStore = getModalStore();

// $: recordId = $page.params.id || '';
// $: isCV = ($userRecordsQuery.data?.cv_ids || []).includes(recordId) || false;
$: chatPickerPopup = {
event: 'click',
target: 'nav-profile-popup',
target: 'chat-picker-popup',
placement: 'bottom'
};

$: matchPickerPopup = {
event: 'click',
target: 'match-picker-popup',
placement: 'bottom'
};
const modalStore = getModalStore();
</script>

<header class="p-2 text-black dark:text-white">
Expand All @@ -35,35 +57,76 @@
/>
</a>
<div class="flex items-center gap-3">
<a href={route('/profile/chat')}>Chats</a>
<button use:popup={navProfilePopup}>
Match
{#if $userRecordsQuery.data?.cv_ids || $userRecordsQuery.data?.vacancy_ids}
<button use:popup={matchPickerPopup}> Match </button>
<div
data-popup={navProfilePopup.target}
data-popup={matchPickerPopup.target}
class="bg-app-blue-50 px-4 py-2 text-black drop-shadow-md"
>
<div class="flex flex-col gap-2">
<a href={route('/cv/match')}>CV</a>
<hr />
<a href={route('/vacancy/match')}>Vacancy</a>
</div>
<div class="arrow bg-app-blue-50"></div>
{#if $userRecordsQuery.data?.cv_ids}
<h3>CV:</h3>
<ul class="list pl-2">
{#each $userRecordsQuery.data.cv_ids as id}
<li>
<a href={route('/cv/match/' + id)}> {id} </a>
</li>
{/each}
</ul>
{/if}
{#if $userRecordsQuery.data?.vacancy_ids}
<h3>Vacancy:</h3>
<ul class="list pl-2">
{#each $userRecordsQuery.data.vacancy_ids as id}
<li>
<a href={route('/vacancy/match/' + id)}> {id} </a>
</li>
{/each}
</ul>
{/if}
</div>
</button>
<button use:popup={navCreatePopup}>
Create
{/if}

{#if $userRecordsQuery.data?.cv_ids || $userRecordsQuery.data?.vacancy_ids}
<button use:popup={chatPickerPopup}> Chats </button>
<div
data-popup={navCreatePopup.target}
data-popup={chatPickerPopup.target}
class="bg-app-blue-50 px-4 py-2 text-black drop-shadow-md"
>
<div class="flex flex-col gap-2">
<a href={route('/cv/create')}>CV</a>
<hr />
<a href={route('/vacancy/create')}>Vacancy</a>
</div>
<div class="arrow bg-app-blue-50"></div>
{#if $userRecordsQuery.data?.cv_ids}
<h3>CV:</h3>
<ul class="list pl-2">
{#each $userRecordsQuery.data.cv_ids as id}
<li>
<a href={route('/profile/chat/' + id)}> {id} </a>
</li>
{/each}
</ul>
{/if}
{#if $userRecordsQuery.data?.vacancy_ids}
<h3>Vacancy:</h3>
<ul class="list pl-2">
{#each $userRecordsQuery.data.vacancy_ids as id}
<li>
<a href={route('/profile/chat/' + id)}> {id} </a>
</li>
{/each}
</ul>
{/if}
</div>
{/if}

<button use:popup={navCreatePopup}> Create </button>
<div
data-popup={navCreatePopup.target}
class="bg-app-blue-50 px-4 py-2 text-black drop-shadow-md"
>
<div class="flex flex-col gap-2">
<a href={route('/cv/create')}>CV</a>
<hr />
<a href={route('/vacancy/create')}>Vacancy</a>
</div>
</button>
<div class="arrow bg-app-blue-50"></div>
</div>
<a
href={route('/integrations')}
class="hidden sm:block">Api</a
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/lib/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ export type VacancyRequest = components['schemas']['VacancyRequestSchema'];

export type CvResponse = components['schemas']['CVResponseSchema'];
export type VacancyResponse = components['schemas']['VacancyResponseSchema'];

export type MessageRequestSchema = components['schemas']['MessageRequestSchema'];
export type MessageResponseSchema = components['schemas']['MessageResponseSchema'];

export type ChatResponseSchema = components['schemas']['ChatResponseSchema'];
export type ChatsResponseSchema = components['schemas']['ChatsResponseSchema'];
1 change: 1 addition & 0 deletions frontend/src/routes/[type=type]/match/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
return res.data;
}
});

const modalStore = getModalStore();
function showModal() {
showWarningModal(modalStore, {
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/routes/[type=type]/match/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Loading from '../Loading.svelte';
import Match, { constructMatcher } from '../Match.svelte';
import RandomMatch from '../RandomMatch.svelte';
import { getRandomCv, getRandomVacancy } from '../mock';

export let data;
$: userMatchGet = data.isCvRoute
Expand Down Expand Up @@ -44,14 +43,18 @@
}
});

$: randomMatchGet = createGetQuery(
data.isCvRoute ? '/api/v1/vacancies/random_vacancy' : '/api/v1/vacancies/random_vacancy'
);
$: randomMatchQuery = createQuery({
queryKey: data.isCvRoute ? ['random vacancy'] : ['random cv'],
queryKey: randomMatchGet.key,
queryFn() {
return data.isCvRoute ? getRandomVacancy() : getRandomCv();
return randomMatchGet.runQuery();
},
staleTime: Infinity
select(res) {
return res.data;
}
});

$: matcher = constructMatcher($userMatchQuery.data, $randomMatchQuery.data);
</script>

Expand Down
74 changes: 0 additions & 74 deletions frontend/src/routes/[type=type]/match/mock.ts

This file was deleted.

66 changes: 0 additions & 66 deletions frontend/src/routes/profile/chat/+layout.svelte

This file was deleted.

1 change: 0 additions & 1 deletion frontend/src/routes/profile/chat/+page.svelte

This file was deleted.

44 changes: 0 additions & 44 deletions frontend/src/routes/profile/chat/Chats.svelte

This file was deleted.

Loading