|
1 | 1 | <script lang="ts"> |
2 | 2 | import { updateProfile } from '$lib/stores/profile'; |
3 | | - import { uploadFile } from '$lib/utils/file-manager'; |
| 3 | + import { resolveAssetUrl, uploadFile } from '$lib/utils/file-manager'; |
4 | 4 | import { toast } from 'svelte-sonner'; |
5 | 5 | import { Card, CardContent, CardHeader, CardTitle } from '@metastate-foundation/ui/card'; |
6 | 6 | import { Button } from '@metastate-foundation/ui/button'; |
7 | 7 | import { Progress } from '@metastate-foundation/ui/progress'; |
8 | 8 |
|
9 | 9 | let { ename, cvFileId, videoIntroFileId, editable = false }: { ename: string; cvFileId?: string; videoIntroFileId?: string; editable?: boolean } = $props(); |
10 | 10 |
|
| 11 | + // New uploads store a public eVault-blob URL; legacy profiles stored a bare |
| 12 | + // file-manager id. resolveAssetUrl handles both so old CVs/videos still render. |
| 13 | + let cvUrl = $derived(resolveAssetUrl(cvFileId)); |
| 14 | + let videoUrl = $derived(resolveAssetUrl(videoIntroFileId)); |
| 15 | +
|
11 | 16 | let uploadingCv = $state(false); |
12 | 17 | let uploadingVideo = $state(false); |
13 | 18 | let cvProgress = $state(0); |
|
87 | 92 | <h3 class="text-sm font-medium text-foreground">CV / Resume</h3> |
88 | 93 | </div> |
89 | 94 |
|
90 | | - {#if cvFileId} |
| 95 | + {#if cvUrl} |
91 | 96 | <div class="mb-2 overflow-hidden rounded border"> |
92 | 97 | <object |
93 | | - data={cvFileId} |
| 98 | + data={cvUrl} |
94 | 99 | type="application/pdf" |
95 | 100 | class="h-48 w-full" |
96 | 101 | > |
97 | | - <a href={cvFileId} target="_blank" rel="noopener noreferrer" class="flex items-center justify-center h-48 text-sm text-muted-foreground hover:underline"> |
| 102 | + <a href={cvUrl} target="_blank" rel="noopener noreferrer" class="flex items-center justify-center h-48 text-sm text-muted-foreground hover:underline"> |
98 | 103 | Download CV |
99 | 104 | </a> |
100 | 105 | </object> |
101 | 106 | </div> |
102 | 107 | <div class="flex items-center gap-2"> |
103 | | - <Button variant="link" size="sm" href={cvFileId} class="h-auto p-0">Download CV</Button> |
| 108 | + <Button variant="link" size="sm" href={cvUrl} class="h-auto p-0">Download CV</Button> |
104 | 109 | {#if editable} |
105 | 110 | <Button variant="link" size="sm" class="h-auto p-0 text-destructive" onclick={removeCv}>Remove</Button> |
106 | 111 | {/if} |
|
131 | 136 | <h3 class="text-sm font-medium text-foreground">Video Introduction</h3> |
132 | 137 | </div> |
133 | 138 |
|
134 | | - {#if videoIntroFileId} |
| 139 | + {#if videoUrl} |
135 | 140 | <div class="mb-2 overflow-hidden rounded border"> |
136 | 141 | <!-- svelte-ignore a11y_media_has_caption --> |
137 | 142 | <video |
138 | | - src={videoIntroFileId} |
| 143 | + src={videoUrl} |
139 | 144 | controls |
140 | 145 | preload="metadata" |
141 | 146 | class="h-48 w-full bg-black" |
142 | 147 | > |
143 | | - <a href={videoIntroFileId} target="_blank" rel="noopener noreferrer">Download Video</a> |
| 148 | + <a href={videoUrl} target="_blank" rel="noopener noreferrer">Download Video</a> |
144 | 149 | </video> |
145 | 150 | </div> |
146 | 151 | <div class="flex items-center gap-2"> |
147 | | - <Button variant="link" size="sm" href={videoIntroFileId} class="h-auto p-0">Download Video</Button> |
| 152 | + <Button variant="link" size="sm" href={videoUrl} class="h-auto p-0">Download Video</Button> |
148 | 153 | {#if editable} |
149 | 154 | <Button variant="link" size="sm" class="h-auto p-0 text-destructive" onclick={removeVideo}>Remove</Button> |
150 | 155 | {/if} |
|
0 commit comments