Skip to content

Commit

Permalink
build(front): refactors video, position, and project fields (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Nov 18, 2023
1 parent dd16d00 commit 7634b0d
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@
"sortable": false
}
},
"title": {
"edit": {
"label": "title",
"description": "",
"placeholder": "",
"visible": true,
"editable": true
},
"list": {
"label": "title",
"searchable": true,
"sortable": true
}
},
"createdAt": {
"edit": {
"label": "createdAt",
Expand Down Expand Up @@ -336,6 +350,10 @@
}
],
[
{
"name": "title",
"size": 4
},
{
"name": "startDate",
"size": 4
Expand Down
7 changes: 4 additions & 3 deletions back/src/api/position/content-types/position/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"type": "uid",
"targetField": "name"
},
"title": {
"type": "string"
},
"startDate": {
"type": "date"
},
Expand All @@ -32,9 +35,7 @@
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images"
]
"allowedTypes": ["images"]
},
"organizations": {
"type": "relation",
Expand Down
3 changes: 2 additions & 1 deletion back/src/components/artifacts/artifact-details.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"options": {},
"attributes": {
"title": {
"type": "string"
"type": "string",
"required": true
},
"files": {
"type": "media",
Expand Down
4 changes: 3 additions & 1 deletion front/src/lib/_utils/shape-shifters/shapeProjectData.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function shapeArtifactData(data) {
case 'artifacts.videos':
shapenedArtifactData.videos.push({
videoFile: artifact.videoFile.data.attributes.url,
videoCaptions: artifact.videoCaptions.data.attributes.url,
videoCaptions: artifact.videoCaptions?.data?.attributes?.url || null,
details: artifact.details,
});
break;
Expand All @@ -28,6 +28,7 @@ export async function shapeProjectData(data) {
let project,
seo,
name,
title,
hero,
startDate,
endDate,
Expand All @@ -43,6 +44,7 @@ export async function shapeProjectData(data) {
project = {
seo,
name,
title,
hero,
startDate,
endDate,
Expand Down
2 changes: 2 additions & 0 deletions front/src/lib/components/cv/Position.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
let {
name,
slug,
title,
summary,
body,
startDate,
Expand All @@ -17,6 +18,7 @@
<h1 class="collection-title">Roles</h1>

<h1>{name}</h1>
{#if title}<h2>{title}</h2>{/if}
{#each skills as { attributes: { name, slug: skillSlug } }}
<h2><a href="/cv/skill/{skillSlug}">{name}</a></h2>
{/each}
Expand Down
18 changes: 11 additions & 7 deletions front/src/lib/components/cv/Project.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,23 @@
{#each videos as { videoFile, videoCaptions, details: { title, URL, description, credits } }}
<h4>{title}</h4>
<div class="video-player">
<!-- svelte-ignore a11y-media-has-caption -->
<!--TODO: Remove ignore-rule -->
<video
crossorigin="anonymous"
controls
class="project-video-player"
>
<source src={videoFile} type="video/mp4" />
<track
default
kind="captions"
type="text/vtt"
src={videoCaptions}
srclang="en"
/>
{#if videoCaptions}
<track
default
kind="captions"
type="text/vtt"
src={videoCaptions}
srclang="en"
/>
{/if}
</video>
</div>
{/each}
Expand Down
8 changes: 4 additions & 4 deletions front/src/routes/cv/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function structurePositions(data) {

export async function load({ params: { pathname } }) {
var cv, positionsData;
let seo, hero, name, intro;
let seo, hero, title, intro;

try {
cv = await api(endpoint);
Expand All @@ -47,11 +47,11 @@ export async function load({ params: { pathname } }) {

({
seo,
content: { hero, name, introduction: intro },
content: { hero, title, introduction: intro },
} = cv);

const page = {
name,
title,
intro,
hero: hero?.data?.attributes || false,
};
Expand All @@ -61,7 +61,7 @@ export async function load({ params: { pathname } }) {
var pageMeta = {
...seo,
type: 'website',
metaTitle: seo?.metaTitle || name,
metaTitle: seo?.metaTitle || title,
};

/**
Expand Down
7 changes: 4 additions & 3 deletions front/src/routes/cv/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
export let data;
const { pathname, page, positions, pageMeta } = data;
const { name, hero, intro } = page;
const { title, hero, intro } = page;
</script>

<PageTransition transitionKey={pathname}>
<section class="cv meat">
<Flourish />
<a id="main">Main Content</a>
<h1>{name}</h1>
<h1>{title}</h1>
{#if hero}
<img src={hero.url} alt={hero.alternativeText} />
{/if}
Expand All @@ -23,9 +23,10 @@
{intro}
</div>
{/if}
{#each positions as { name, slug, startDate, endDate, summary, awards, industries, organizations, projects, skills }, i}
{#each positions as { name, slug, title, startDate, endDate, summary, awards, industries, organizations, projects, skills }, i}
<div class="position-timeline-item">
<h1><a href="/cv/position/{slug}">{name}</a></h1>
{#if title}<h2>{title}</h2>{/if}
<date class="position-timeline-date"
>{#if endDate}{startDate}{:else}Current{/if}</date
>
Expand Down

0 comments on commit 7634b0d

Please sign in to comment.