Skip to content

Commit 525be76

Browse files
Changed icons and delete of candidate removes ratings
1 parent c720757 commit 525be76

6 files changed

Lines changed: 56 additions & 37 deletions

File tree

shared/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ export type Profile = {
222222
*/
223223
receiveFeedbackRequests?: BooleanRecord;
224224
} & ProfileBase &
225-
Entity;
225+
Entity;

web/components/workspace/WorkspaceCandidateDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<SideDialogShell
33
position="right"
4-
title="Add candidate review"
4+
title="Add candidate"
55
:icon="tabUserCode"
66
:visible="visible"
77
@close="visible = false"

web/components/workspace/WorkspaceReviewsPanel.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,22 @@ const ratings = computed(() =>
272272
);
273273
274274
/**
275-
* Handles deletion of the candidate
275+
* Handles deletion of the candidate; removes any ratings for this candidate from
276+
* the workspace.
276277
*/
277278
async function handleCandidateDelete(uid: string) {
278279
await candidateReviewRepository.deleteById(uid);
280+
281+
// We also need to remove the comments from the workspace with this candidate UID
282+
let workspaceUpdate: EntityUpdate<Workspace> = {};
283+
284+
for (const key of Object.keys(workspace.value.ratings ?? {})) {
285+
if (key.startsWith(uid)) {
286+
workspaceUpdate = { ...workspaceUpdate, [`ratings.${key}`]: deleteField() };
287+
}
288+
}
289+
290+
await workspaceRepository.updateFields(workspace.value.uid, workspaceUpdate);
279291
}
280292
281293
/**

web/pages/index.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
-->
140140
</section>
141141

142+
<!--
142143
<section class="row q-px-md">
143144
<div class="col-12">
144145
<h2
@@ -218,6 +219,29 @@
218219
</div>
219220
</div>
220221
</section>
222+
-->
223+
<section class="q-px-md">
224+
<h2
225+
class="q-my-none q-pt-xl q-pb-md"
226+
:class="[dark ? 'text-deep-purple-3' : 'text-accent']"
227+
>
228+
3 Features in 60 seconds
229+
</h2>
230+
<video
231+
preload="none"
232+
controls
233+
name="media"
234+
style="width: 100%"
235+
class="rounded-borders shadow-2"
236+
poster="https://storage.googleapis.com/media.coderev.app/coderev-features.webp"
237+
title="CodeRev.app 3 minute intro."
238+
>
239+
<source
240+
src="https://storage.googleapis.com/media.coderev.app/code-rev-palette-720p.mp4"
241+
type="video/mp4"
242+
/>
243+
</video>
244+
</section>
221245

222246
<section class="q-px-md">
223247
<h2

web/pages/workspace/[uid].vue

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
:class="{
7171
'bg-grey-8': tab === 'reviews' && !route.fullPath.includes('/c/'),
7272
}"
73-
:icon="tabFilePencil"
73+
:icon="tabUsers"
7474
@click="navigateTab('reviews')"
7575
size="md"
7676
flat
@@ -86,7 +86,7 @@
8686
:class="{
8787
'bg-grey-8': route.fullPath.includes('/c/'),
8888
}"
89-
:icon="tabUser"
89+
:icon="tabUserEdit"
9090
@click="mini = !mini"
9191
size="md"
9292
dense
@@ -96,17 +96,6 @@
9696
Candidate: {{ candidate.label ?? candidate.email }}
9797
</QTooltip>
9898
</QBtn>
99-
<QBtn
100-
:icon="tabArrowUpLeft"
101-
@click="navigateTo(`/workspace/${workspace.uid}`)"
102-
size="md"
103-
dense
104-
flat
105-
>
106-
<QTooltip self="center left" anchor="center right">
107-
Back to candidates
108-
</QTooltip>
109-
</QBtn>
11099
</template>
111100
</div>
112101

@@ -235,7 +224,7 @@
235224
clickable
236225
>
237226
<QItemSection avatar>
238-
<QIcon :name="tabFilePencil" />
227+
<QIcon :name="tabUsers" />
239228
</QItemSection>
240229
<QItemSection>
241230
<QItemLabel class="text-h6">Reviews</QItemLabel>
@@ -246,7 +235,7 @@
246235
<QCard v-if="route.fullPath.includes('/c/')" class="bg-grey-9">
247236
<QItem v-if="!editCandidate" v-bind="leftMenuProps">
248237
<QItemSection style="justify-content: start" avatar>
249-
<QIcon :name="tabUser" />
238+
<QIcon :name="tabUserEdit" />
250239
</QItemSection>
251240
<QItemSection>
252241
<QItemLabel class="text-body1" style="word-break: break-all" lines="2">{{
@@ -265,15 +254,6 @@
265254
/>
266255
</template>
267256
<QCardActions align="right">
268-
<QBtn
269-
:icon="tabArrowUpLeft"
270-
color="white"
271-
label="Back"
272-
@click="navigateTo(`/workspace/${workspace.uid}`)"
273-
unelevated
274-
outline
275-
no-caps
276-
/>
277257
<template v-if="editCandidate">
278258
<QBtn :icon="tabX" @click="editCandidate = false" flat />
279259
<QBtn
@@ -290,11 +270,12 @@
290270
flat
291271
/>
292272
<QBtn
293-
:icon="tabClipboard"
273+
:icon="copied ? tabCheck : tabClipboard"
274+
:color="copied ? 'light-green' : undefined"
294275
@click="copy(`${baseUrl}/review/${candidate.uid}`)"
295276
flat
296277
>
297-
<QTooltip>Copy URL</QTooltip>
278+
<QTooltip>{{ copied ? "Copied to clipboard!" : "Copy URL" }}</QTooltip>
298279
</QBtn>
299280
<DeleteConfirmButton
300281
message="Are you sure you want to delete this candidate?"
@@ -319,12 +300,8 @@
319300
import { navigateTo } from "nuxt/app";
320301
import { defaultWorkspace } from "../../stores/workspaceStore";
321302
import {
322-
tabArrowLeft,
323-
tabArrowUpLeft,
324303
tabClipboard,
325-
tabUser,
326304
tabDeviceFloppy,
327-
tabFilePencil,
328305
tabFiles,
329306
tabPencil,
330307
tabUsersGroup,
@@ -334,9 +311,10 @@ import {
334311
tabSun,
335312
tabBrandGithub,
336313
tabArrowBarToRight,
337-
tabInfoCircle,
338-
tabInfoSquare,
339314
tabInfoSquareRounded,
315+
tabUsers,
316+
tabUserEdit,
317+
tabCheck,
340318
} from "quasar-extras-svg-icons/tabler-icons-v2";
341319
import { leftMenuProps } from "../../utils/commonProps";
342320
import { baseUrl } from "../../utils/environment";
@@ -358,7 +336,7 @@ const appStore = useAppStore();
358336
359337
const { showLeftDrawer, dark } = storeToRefs(appStore);
360338
361-
const { copy } = useClipboard();
339+
const { copy, copied, text } = useClipboard();
362340
363341
const tab = ref("files");
364342

web/utils/data/Repository.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import {
1818
import type { Unsubscribe } from "firebase/auth";
1919
import dayjs from "dayjs";
2020

21+
/**
22+
* Type used to represent an entity update that allows for deletion
23+
*/
24+
export type EntityUpdate<T extends Entity> ={ [P in keyof T]?: T[P] | undefined | FieldValue }
25+
2126
/**
2227
* Replaces an entity in a collection with a new one that has been updated.
2328
* @param collection The collection to splice
@@ -169,7 +174,7 @@ export abstract class Repository<T extends Entity> {
169174
*/
170175
public async updateFields(
171176
uid: string,
172-
entity: { [P in keyof T]?: T[P] | undefined | FieldValue }
177+
entity: EntityUpdate<T>
173178
) {
174179
const { profile } = useAppStore();
175180

0 commit comments

Comments
 (0)