Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release note link for videos with two versions #1443

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/components/VideoCards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import clsx from 'clsx';
import Link from '@docusaurus/Link';
import LiteYouTube from '@site/src/components/LiteYouTube';
import styles from './styles.module.css';
import { Video } from '@site/src/data/types';

function VideoCards({ videos }) {
function VideoCards({ videos }: { videos: Video[] }) {
return (
<section className="margin-top--lg margin-bottom--xl">
<div className="container">
Expand All @@ -34,7 +35,12 @@ function VideoCards({ videos }) {
);
}

function VideoCard({ video }) {
function videoToReleasePageAnchor(video: Video) {
const versions = video.version.split(' & ');
return `version-${versions[versions.length - 1].replace('.', '')}`;
}

function VideoCard({ video }: { video: Video }) {
return (
<li key={video.title} className="card shadow--md">
<div className={styles.videoCardVideo}>
Expand Down Expand Up @@ -64,10 +70,7 @@ function VideoCard({ video }) {
{video.version ? (
<div className={styles.videoCardHeader}>
<Link
href={`/docs/release-notes#version-${video.version.replace(
'.',
''
)}`}
href={`/docs/release-notes#${videoToReleasePageAnchor(video)}`}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main fix, the rest is drive-by.

>
<h4 className={styles.videoCardTitle}>
Playwright v{video.version}
Expand Down
4 changes: 3 additions & 1 deletion src/data/conference-videos.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const conferenceVideos = [
import { Video } from './types';

const conferenceVideos: Video[] = [
{
title: "Playwright : l'outil qui va révolutionner les tests end-to-end",
id: 'fQ4LICkmG9I',
Expand Down
4 changes: 3 additions & 1 deletion src/data/learn-videos.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const learnVideos = [
import { Video } from './types';

const learnVideos: Video[] = [
{
title: 'How to Run Tests in Playwright with the VS Code Extension',
description: '',
Expand Down
4 changes: 3 additions & 1 deletion src/data/release-videos.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const releaseVideos = [
import { Video } from './types';

const releaseVideos: Video[] = [
{
version: '1.45',
id: "54_aC-rVKHg",
Expand Down
15 changes: 15 additions & 0 deletions src/data/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export type Video = {
version?: string;
speakers?: string[];
id?: string;
title?: string;
description?: string;
highlights?: string[];
year?: string;
thumbnail?: string;
url?: string;
src?: string;
conference?: string;
host?: string;
language?: string;
};
Loading