Skip to content

Commit

Permalink
feat(nx-dev): refactor and improve style of video-player (#29749)
Browse files Browse the repository at this point in the history
  • Loading branch information
juristr authored Jan 28, 2025
1 parent e0c49d3 commit 5127c15
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 122 deletions.
8 changes: 0 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ You can optionally also pass a `path` like
‎```
````

#### Terminal Video Output

You can have a more dynamic visualization of a terminal output by using the following component:

```
{% terminal-video src="/documentation/shared/images/caching/cache-terminal-animation.mp4" /%}
```

#### Table of Contents

You can add a table of contents to your document by using the following component. This is mostly useful for blog posts.
Expand Down
6 changes: 3 additions & 3 deletions docs/blog/2024-05-08-nx-19-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Notice how all tasks are now appropriately grouped in the `E2E (CI)` group!

You can also find the same enhancements in Nx Cloud. Below is a view of all tasks in the CI pipeline:

{% video-player src="/documentation/blog/media/2024-05-08/nx-cloud-atomizer-groupings.mp4" alt="Showing the Atomizer in Nx Cloud" /%}
{% video-player src="/documentation/blog/media/2024-05-08/nx-cloud-atomizer-groupings.mp4" alt="Showing the Atomizer in Nx Cloud" autoPlay=true loop=true /%}

Notice how all e2e groups are collapsed by default to give a concise view, while allowing you to expand to see how each individual task is progressing!

Expand Down Expand Up @@ -160,7 +160,7 @@ Since Nx 18 release, we also started using Project Crystal inside of the Nx repo

You can find a full list of fixes and features applied in this major release [here](https://github.com/nrwl/nx/releases/tag/19.0.0).

{% video-player src="/documentation/blog/media/2024-05-08/fixes.mp4" alt="A display listing the Github changelog" /%}
{% video-player src="/documentation/blog/media/2024-05-08/fixes.mp4" alt="A display listing the Github changelog" autoPlay=true loop=true /%}

With Project Crystal landed now, we're also adjusting our priorities to place a higher importance on stability. You should see this reflected in Nx 19.

Expand All @@ -182,7 +182,7 @@ In February, we launched two big enhancements to Nx Cloud: the [Atomizer](/ci/fe

Since then, the Atomizer has received a nice UI update (as we had seen earlier):

{% video-player src="/documentation/blog/media/2024-05-08/nx-cloud-atomizer-groupings.mp4" alt="Showing the Atomizer in Nx Cloud" /%}
{% video-player src="/documentation/blog/media/2024-05-08/nx-cloud-atomizer-groupings.mp4" alt="Showing the Atomizer in Nx Cloud" autoPlay=true loop=true /%}

Since February, we also revamped our task distribution algorithms. This has resulted in a 5-20% (depending on the repo) increase in both speed and cost efficiency for our users.

Expand Down
4 changes: 2 additions & 2 deletions docs/blog/2024-12-06-nx-cloud-pipelines-in-nx-console.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ We're in the process of adding a new integration between [Nx Cloud](/nx-cloud),

Now, once you've [connected your Nx Console to Nx Cloud](https://blog.nrwl.io/nx-console-meets-nx-cloud-d45dc099dc5d), you will have access to a new panel in the console that shows all of your recent CI Pipelines, including those in progress now.

{% video-player src="/documentation/blog/media/nx-console-pipeline-running.mp4" alt="Nx Console CI Pipeline Execution" /%}
{% video-player src="/documentation/blog/media/nx-console-pipeline-running.mp4" alt="Nx Console CI Pipeline Execution" autoPlay=true loop=true /%}

This way, you can keep an eye on the status of the pipeline of your latest PR, and always just 1 click away from seeing detailed your results on Nx Cloud.

## Notifications On What You Care About Most

In addition to a panel where you can see all of your recent pipelines, you can also receive pop-up notifications when a pipeline completes

{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" /%}
{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" autoPlay=true loop=true /%}

Head to the Nx Console settings to adjust controls on these notifications. This will allow you to adjust notifications to only show for failed runs if you prefer, or to turn off the notifications altogether.

Expand Down
6 changes: 3 additions & 3 deletions docs/blog/2024-12-22-nx-highlights-2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ Nx Console has become a key part of the "Nx experience." In 2024, we introduced

One standout feature is the **Project Detail View**. With Project Crystal, Nx can dynamically infer targets from your configuration. You can see these [inferred tasks](/concepts/inferred-tasks) by running `nx show project my-project --web`, but now they’re directly available inside Nx Console. This gives you quick access to project details, command options, caching configurations, and more, right in your editor.

{% video-player src="/documentation/blog/media/nxconsole-project-view.mp4" alt="Nx Console Project Detail View" /%}
{% video-player src="/documentation/blog/media/nxconsole-project-view.mp4" alt="Nx Console Project Detail View" autoPlay=true loop=true /%}

Another big addition is **CI Pipeline Visualization** for Nx Cloud.

{% video-player src="/documentation/blog/media/nx-console-pipeline-running.mp4" alt="Nx Console CI Pipeline Execution" /%}
{% video-player src="/documentation/blog/media/nx-console-pipeline-running.mp4" alt="Nx Console CI Pipeline Execution" autoPlay=true loop=true /%}

Nx Console notifies you inside your IDE when pipelines succeed or fail. This removes the need to monitor CI logs or constantly switch between tools.

{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" /%}
{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" autoPlay=true loop=true /%}

These updates make CI more accessible and help you stay focused without leaving your development environment.

Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2025-01-06-nx-update-20-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ We launched a [new feature](/blog/nx-cloud-pipelines-come-to-nx-console) for [Nx

This feature allows you to have access to the status of your pending pipelines - including the ability to get notifications when one of your Nx Cloud pipelines completes - right from your IDE!

{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" /%}
{% video-player src="/documentation/blog/media/nxconsole-ci-completion.mp4" alt="Nx Console CI Completion" autoPlay=true loop=true /%}

You have access to this feature today if you're using the VsCode version of the plugin, and we plan to bring this to the JetBrains version soon.

Expand Down
6 changes: 0 additions & 6 deletions nx-dev/ui-markdoc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ import { Tab, Tabs } from './lib/tags/tabs.component';
import { tab, tabs } from './lib/tags/tabs.schema';
import { Tweet, tweet } from '@nx/nx-dev/ui-common';
import { YouTube, youtube } from '@nx/nx-dev/ui-common';
import {
TerminalVideo,
terminalVideo,
} from './lib/tags/terminal-video.component';
import { VideoLink, videoLink } from './lib/tags/video-link.component';
// import { SvgAnimation, svgAnimation } from './lib/tags/svg-animation.component';
import { Pill } from './lib/tags/pill.component';
Expand Down Expand Up @@ -93,7 +89,6 @@ export const getMarkdocCustomConfig = (
'side-by-side': sideBySide,
tab,
tabs,
'terminal-video': terminalVideo,
toc: tableOfContents,
tweet,
youtube,
Expand Down Expand Up @@ -125,7 +120,6 @@ export const getMarkdocCustomConfig = (
Tab,
Tabs,
TableOfContents,
TerminalVideo,
Tweet,
YouTube,
VideoLink,
Expand Down
40 changes: 40 additions & 0 deletions nx-dev/ui-markdoc/src/lib/tags/client-video.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use client';
import { useRef } from 'react';

export function ClientVideo({
src,
alt,
showControls = false,
autoPlay = true,
loop: explicitLoop,
}: {
src: string;
alt: string;
showControls?: boolean;
autoPlay?: boolean;
loop?: boolean;
}): JSX.Element {
const videoRef = useRef<HTMLVideoElement | null>(null);
const loop = explicitLoop ?? autoPlay;

return (
<video
ref={videoRef}
autoPlay={autoPlay}
muted
loop={loop}
playsInline
controls={showControls}
className="m-0 p-0"
>
<source src={src} type="video/mp4" />
<div className="p-4 text-center">
<p className="pb-3 font-bold">
Your browser does not support the video tag. Here is a description of
the video:
</p>
<p>{alt}</p>
</div>
</video>
);
}
33 changes: 0 additions & 33 deletions nx-dev/ui-markdoc/src/lib/tags/terminal-video.component.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions nx-dev/ui-markdoc/src/lib/tags/video-loop.component.tsx

This file was deleted.

55 changes: 45 additions & 10 deletions nx-dev/ui-markdoc/src/lib/tags/video-player.component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { VideoLoop } from './video-loop.component';
import { Schema } from '@markdoc/markdoc';
import { ClientVideo } from './client-video.component';

export const videoPlayer: Schema = {
render: 'VideoPlayer',
Expand All @@ -16,27 +16,62 @@ export const videoPlayer: Schema = {
type: 'String',
required: false,
},
showControls: {
type: 'Boolean',
required: false,
default: false,
},
autoPlay: {
type: 'Boolean',
required: false,
default: false,
},
loop: {
type: 'Boolean',
required: false,
default: false,
},
},
};

export function VideoPlayer({
src,
alt,
link,
showControls,
autoPlay,
loop,
}: {
src: string;
alt: string;
link: string;
link?: string;
showControls?: boolean;
autoPlay?: boolean;
loop?: boolean;
}): JSX.Element {
return (
<div className="overflow-x-auto">
{link ? (
<a href={link} target="_blank" rel="noreferrer">
<VideoLoop src={src} alt={alt}></VideoLoop>
</a>
) : (
<VideoLoop src={src} alt={alt}></VideoLoop>
)}
<div className="mb-4 overflow-x-auto">
<div className="rounded-lg border border-slate-200 bg-slate-50/50 dark:border-slate-700 dark:bg-slate-800/60">
{link ? (
<a href={link} target="_blank" rel="noreferrer">
<ClientVideo
src={src}
alt={alt}
showControls={showControls}
autoPlay={autoPlay}
loop={loop}
/>
</a>
) : (
<ClientVideo
src={src}
alt={alt}
showControls={showControls}
autoPlay={autoPlay}
loop={loop}
/>
)}
</div>
</div>
);
}

0 comments on commit 5127c15

Please sign in to comment.