Skip to content

Commit a0726f0

Browse files
committed
add course for svelte-firebase
1 parent c444d95 commit a0726f0

32 files changed

Lines changed: 107 additions & 993 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<script lang="ts">
2+
/* USE <Image> component directly NOT this component */
3+
4+
export let src: string;
5+
export let poster = '';
6+
export let classes: string = 'object-cover w-full bg-cover rounded bg-black/50 aspect-video';
7+
8+
import { lazyload, HtmlVideoLayer, type VideoSources } from '@cloudinary/html';
9+
import { CloudinaryImage, CloudinaryVideo } from '@cloudinary/url-gen';
10+
import { format, quality } from '@cloudinary/url-gen/actions/delivery';
11+
import { auto } from '@cloudinary/url-gen/qualifiers/format';
12+
import { onMount } from 'svelte';
13+
14+
let bindVideo: HTMLVideoElement | null = null;
15+
onMount(() => {
16+
const matchVideo = src.match(/upload\/(?:v\d+\/)?(.+?)\.[^\.]+$/)?.at(1);
17+
const removeVideoFront = src.replace('https://media.codingcat.dev/video/upload/', '');
18+
const newVideo = new CloudinaryVideo(
19+
matchVideo || removeVideoFront,
20+
{ cloudName: 'none' },
21+
{ secureDistribution: 'media.codingcat.dev', privateCdn: true, secure: true }
22+
)
23+
.delivery(format(auto()))
24+
.delivery(quality('auto'));
25+
let newImage;
26+
if (poster) {
27+
const matchImage = poster.match(/upload\/(?:v\d+\/)?(.+?)\.[^\.]+$/)?.at(1);
28+
const removeImageFront = poster.replace('https://media.codingcat.dev/image/upload/', '');
29+
newImage = new CloudinaryImage(
30+
matchImage || removeImageFront,
31+
{ cloudName: 'none' },
32+
{ secureDistribution: 'media.codingcat.dev', privateCdn: true, secure: true }
33+
)
34+
.delivery(format(auto()))
35+
.delivery(quality('auto'));
36+
}
37+
console.log('newImage', newImage);
38+
new HtmlVideoLayer(bindVideo, newVideo, undefined, undefined, undefined, newImage);
39+
});
40+
</script>
41+
42+
<!-- svelte-ignore a11y-media-has-caption -->
43+
<video bind:this={bindVideo} class={`cld-video-player ${classes}`} controls autoplay />

apps/codingcatdev/src/lib/components/content/Video.svelte renamed to apps/codingcatdev/src/lib/components/content/YouTube.svelte

File renamed without changes.

‎apps/codingcatdev/src/lib/types/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface Content {
1717
title: string;
1818
updated?: Date;
1919
weight?: number;
20+
videoCloudinary?: string;
2021
youtube?: string;
2122
}
2223

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/Content.svelte‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Icon } from '@steeze-ui/svelte-icon';
44
import { ArrowTopRightOnSquare } from '@steeze-ui/heroicons';
55
6-
import Video from '$lib/components/content/Video.svelte';
6+
import YouTube from '$lib/components/content/YouTube.svelte';
77
import type { Author, Content, Podcast, Sponsor } from '$lib/types';
88
import { ContentType } from '$lib/types';
99
import { pluralize } from '$lib/utils';
@@ -31,7 +31,7 @@
3131
<li>{data.content.title}</li>
3232
</ol>
3333
{#if data?.content?.youtube}
34-
<Video src={data.content.youtube} title={`${data.content.title}`} />
34+
<YouTube src={data.content.youtube} title={`${data.content.title}`} />
3535
{:else if data?.content?.cover}
3636
<Image src={data.content.cover} alt={data.content.title} />
3737
{/if}

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/podcast/cwcc-0-6-remix-with-kent-c-dodds/+page.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ youtube: https://youtu.be/ZWVYJOclIXY
2626
---
2727

2828
<script lang="ts">
29-
import Video from '$lib/components/content/Video.svelte'
29+
import YouTube from '$lib/components/content/YouTube.svelte'
3030
import Shorts from '$lib/components/content/Shorts.svelte'
3131
</script>
3232

@@ -160,14 +160,14 @@ Remix offers several advantages over other React frameworks:
160160

161161
## Shorts
162162

163-
<Video title="Exciting future developments in Angular Router and Remix Router" src="https://youtube.com/shorts/kx5CVRBnhdI" />
164-
<Video title="No JavaScript Needed State Management for Apps Made Easy" src="https://youtube.com/shorts/Mc0awq5d15A" />
165-
<Video title="Mastering React Using Closures to Avoid Bugs" src="https://youtube.com/shorts/lvM-8rzPGgk" />
166-
<Video title="Revolutionary Remix Ensuring Seamless JavaScript Experience for Users" src="https://youtube.com/shorts/RRa2mfs5YcQ" />
167-
<Video title="Revolutionary Remix Router Revolutionizing UX and DX on a Server" src="https://youtube.com/shorts/TURK2J6yxfA" />
168-
<Video title="Revolutionize your Web Experiences with Remix The Ultimate JavaScript Framework" src="https://youtube.com/shorts/5QOjDtmLWrU" />
169-
<Video title="Revolutionizing Data Loading Remix Center Stack Simplifies JavaScript Development" src="https://youtube.com/shorts/LRBUVrFH27k" />
170-
<Video title="Remix Center Stack Simplifies JavaScript Development" src="https://youtube.com/shorts/LRBUVrFH27k" />
171-
<Video title="Data Management Remix Makes Network Tab a Breeze" src="https://youtube.com/shorts/GspbUXLmpeY" />
172-
<Video title="Spicing Up My Background with a Neon Remix Sign" src="https://youtube.com/shorts/3UlJknYDV8w" />
173-
<Video title="Unleash Your Creativity with the Ultimate Fake Books App in Remix" src="https://youtube.com/shorts/TbdZU7b2bKQ" />
163+
<YouTube title="Exciting future developments in Angular Router and Remix Router" src="https://youtube.com/shorts/kx5CVRBnhdI" />
164+
<YouTube title="No JavaScript Needed State Management for Apps Made Easy" src="https://youtube.com/shorts/Mc0awq5d15A" />
165+
<YouTube title="Mastering React Using Closures to Avoid Bugs" src="https://youtube.com/shorts/lvM-8rzPGgk" />
166+
<YouTube title="Revolutionary Remix Ensuring Seamless JavaScript Experience for Users" src="https://youtube.com/shorts/RRa2mfs5YcQ" />
167+
<YouTube title="Revolutionary Remix Router Revolutionizing UX and DX on a Server" src="https://youtube.com/shorts/TURK2J6yxfA" />
168+
<YouTube title="Revolutionize your Web Experiences with Remix The Ultimate JavaScript Framework" src="https://youtube.com/shorts/5QOjDtmLWrU" />
169+
<YouTube title="Revolutionizing Data Loading Remix Center Stack Simplifies JavaScript Development" src="https://youtube.com/shorts/LRBUVrFH27k" />
170+
<YouTube title="Remix Center Stack Simplifies JavaScript Development" src="https://youtube.com/shorts/LRBUVrFH27k" />
171+
<YouTube title="Data Management Remix Makes Network Tab a Breeze" src="https://youtube.com/shorts/GspbUXLmpeY" />
172+
<YouTube title="Spicing Up My Background with a Neon Remix Sign" src="https://youtube.com/shorts/3UlJknYDV8w" />
173+
<YouTube title="Unleash Your Creativity with the Ultimate Fake Books App in Remix" src="https://youtube.com/shorts/TbdZU7b2bKQ" />

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/podcast/cwcc-1-1-angular-17/+page.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ youtube: https://youtube.com/live/Yy0XJP9ReJk?feature=share
2626
---
2727

2828
<script lang="ts">
29-
import Video from '$lib/components/content/Video.svelte'
29+
import YouTube from '$lib/components/content/YouTube.svelte'
3030
import Shorts from '$lib/components/content/Shorts.svelte'
3131
</script>
3232

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/post/angular-17-cypress-testing/+page.md‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ youtube: https://youtu.be/w3smSGP4w1M
1414
---
1515

1616
<script lang="ts">
17-
import Video from '$lib/components/content/Video.svelte'
17+
import YouTube from '$lib/components/content/YouTube.svelte'
1818
import Shorts from '$lib/components/content/Shorts.svelte'
1919
</script>
2020

@@ -87,13 +87,13 @@ Angular component testing is an important part of developing Angular application
8787

8888
## Shorts
8989

90-
<Video src="https://youtube.com/shorts/jum4EQkvr2E" title="Beat the Winter Blues and Boost Your Productivity with Simple Changes" />
91-
<Video src="https://youtube.com/shorts/oUz4Dg6bfCM" title="Injury Forces Me to Give Up Working Out My Mental Struggle" />
92-
<Video src="https://youtube.com/shorts/OnXj8czngfM" title="Mastering my Fitness Routine A WellStructured Gym Week" />
93-
<Video src="https://youtube.com/shorts/vgeDC6VOhOE" title="Revolutionizing Time Zones A World United by a Single Time" />
94-
<Video src="https://youtube.com/shorts/i4ekWDkOmt4" title="Unbelievable Opportunity Google Sends Me to Singapore for Creators Conference" />
95-
<Video src="https://youtube.com/shorts/yiVoxYL69rI" title="The versatility of Angular Testing maintenance and love for the framework" />
96-
<Video src="https://youtube.com/shorts/x968CKBoKbY" title="Unleashing Angular The Exciting Update Revealing its Natural Learning Curve" />
97-
<Video src="https://youtube.com/shorts/ZiDT55SOk2c" title="Unlock Your Days Potential Conquer Challenges First for Maximum Success" />
98-
<Video src="https://youtube.com/shorts/z5wS0YNtwsI" title="Unleashing the Power of Angular Exploring Exciting New Changes" />
99-
<Video src="https://youtube.com/shorts/MADkeUFuXhE" title="Angular's Scully The Missing Link for Angular Web Development?" />
90+
<YouTube src="https://youtube.com/shorts/jum4EQkvr2E" title="Beat the Winter Blues and Boost Your Productivity with Simple Changes" />
91+
<YouTube src="https://youtube.com/shorts/oUz4Dg6bfCM" title="Injury Forces Me to Give Up Working Out My Mental Struggle" />
92+
<YouTube src="https://youtube.com/shorts/OnXj8czngfM" title="Mastering my Fitness Routine A WellStructured Gym Week" />
93+
<YouTube src="https://youtube.com/shorts/vgeDC6VOhOE" title="Revolutionizing Time Zones A World United by a Single Time" />
94+
<YouTube src="https://youtube.com/shorts/i4ekWDkOmt4" title="Unbelievable Opportunity Google Sends Me to Singapore for Creators Conference" />
95+
<YouTube src="https://youtube.com/shorts/yiVoxYL69rI" title="The versatility of Angular Testing maintenance and love for the framework" />
96+
<YouTube src="https://youtube.com/shorts/x968CKBoKbY" title="Unleashing Angular The Exciting Update Revealing its Natural Learning Curve" />
97+
<YouTube src="https://youtube.com/shorts/ZiDT55SOk2c" title="Unlock Your Days Potential Conquer Challenges First for Maximum Success" />
98+
<YouTube src="https://youtube.com/shorts/z5wS0YNtwsI" title="Unleashing the Power of Angular Exploring Exciting New Changes" />
99+
<YouTube src="https://youtube.com/shorts/MADkeUFuXhE" title="Angular's Scully The Missing Link for Angular Web Development?" />

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/post/aws-amplify-video/+page.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class VideoPlayer extends React.Component {
154154
return (
155155
<div>
156156
<div data-vjs-player>
157-
<video
157+
<YouTube
158158
ref={(node) => {
159159
this.videoNode = node;
160160
}}

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/post/building-a-fun-app-with-ionic-studio-and-cloudinary/+page.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ upload_preset is now all set for incorporation into the code:
4949
Now complete the upload through the endpoint:
5050

5151
```html
52-
<video controls="controls" height="600">
52+
<YouTube controls="controls" height="600">
5353
<source
5454
src="https://res.cloudinary.com/ajonp/video/upload/q_auto/ajonp-ajonp-com/blog/cloudinary_api_endpoing_upload.webm"
5555
type="video/webm"

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/post/how-to-achieve-16-9-resolution-while-using-divvy-on-a-mac/+page.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ title: How to achieve 16:9 resolution while using Divvy on a Mac
1515
---
1616

1717
<script lang="ts">
18-
import Video from '$lib/components/content/Video.svelte';
18+
import YouTube from '$lib/components/content/YouTube.svelte';
1919
</script>
2020

2121
Have you ever tried to record a video and notice that it is a few pixels off? Lets fix that so you can produce good quality videos!
@@ -96,7 +96,7 @@ So if you screen is 4K 3840px by 2160px, and your menu is 24px high then your ac
9696

9797
This is an amazingly simple, but yet very powerful tool. You can break your screen up into anything from 1x1 all the way to 10x10 blocks. There are a lot more features check out the below video to see more of what is possible.
9898

99-
<Video src="https://youtu.be/Z6eBPC-4ZOY" title="Divvy Blocks" />
99+
<YouTube src="https://youtu.be/Z6eBPC-4ZOY" title="Divvy Blocks" />
100100

101101
## What is the big deal
102102

0 commit comments

Comments
 (0)