feat: add delete button for cached files

This commit is contained in:
EETagent 2022-12-05 23:26:47 +01:00
parent 3f22192835
commit 7c209ebbbc
5 changed files with 29 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadCoverLetter } from '$lib/@api/candidate';
import { apiDeleteCoverLetter, apiUploadCoverLetter } from '$lib/@api/candidate';
import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
@ -9,10 +9,16 @@
await apiUploadCoverLetter(file, callback);
await fetchSubmProgress();
};
const onDelete = async () => {
await apiDeleteCoverLetter();
await fetchSubmProgress();
};
</script>
<DashboardUploadCard
on:filedrop={(e) => onFileDrop(e.detail)}
on:delete={onDelete}
title="Motivační dopis"
filetype="PDF"
filesize={10}

View file

@ -101,7 +101,13 @@
<div class="mb-4 mt-1 sm:mb-0 sm:mt-0">
<FileType {filetype} filesize={filesize + ' MB'} />
</div>
<div class="absolute right-0 top-4 px-7">
<div class="absolute right-0 top-4 flex items-center px-7">
{#if status === 'uploaded'}
<button
class="mr-3 rounded-xl bg-[#ef8b46] py-0.5 px-2 text-white shadow-md transition-all duration-300 hover:bg-orange-400"
on:click={() => dispatch('delete')}>Smazat</button
>
{/if}
<StatusNotificationDot {status} />
</div>
</div>

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioLetter } from '../../@api/candidate';
import { apiDeletePortfolioLetter, apiUploadPortfolioLetter } from '../../@api/candidate';
import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
@ -9,10 +9,16 @@
await apiUploadPortfolioLetter(file, callback);
await fetchSubmProgress();
};
const onDelete = async () => {
await apiDeletePortfolioLetter();
await fetchSubmProgress();
};
</script>
<DashboardUploadCard
on:filedrop={(e) => onFileDrop(e.detail)}
on:delete={onDelete}
title="Portfolio"
filetype="PDF"
filesize={10}

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioZip } from '$lib/@api/candidate';
import { apiDeletePortfolioZip, apiUploadPortfolioZip } from '$lib/@api/candidate';
import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
@ -9,10 +9,16 @@
await apiUploadPortfolioZip(file, callback);
await fetchSubmProgress();
};
const onDelete = async () => {
await apiDeletePortfolioZip();
await fetchSubmProgress();
};
</script>
<DashboardUploadCard
on:filedrop={(e) => onFileDrop(e.detail)}
on:delete={onDelete}
title="Další data"
filetype="ZIP"
filesize={100}

View file

@ -19,7 +19,7 @@
<!-- make red dot -->
<div class="flex animate-pulse flex-row justify-between div-{status}">
<span class="mt-1 h-6 w-6 rounded-full {status}" />
<span class="h-6 w-6 rounded-full {status}" />
<!-- <h3 class="ml-8 font-bold text-xl">{title}</h3> -->
</div>