Skip to content

Conversation

nikpachoo
Copy link
Collaborator

@nikpachoo nikpachoo commented Aug 14, 2025

https://youtrack.jetbrains.com/issue/KTL-2944/Add-webteam-youtube-playlist

20-minute-adventure-rick-morty

How does it work

By default WEBTEAM_UI_NPM_TOKEN is expected.
External users can set export USE_FALLBACK_FOR_INTERNAL_PACKAGES=1 to install dependencies and run the website locally.
In this case, a fallback UI component will be used.

How we can use webteam-ui

No limits, we just need to to the following things:

  • add a package to the transpiledPackagessection in the next.js config.
  • provide a fallback for a case when webteam-ui is not available.

@@ -5,7 +5,8 @@ import cn from 'classnames';
import styles from './additional-materials.module.css';
import { useTextStyles } from '@rescui/typography';

import YoutubePlayer from '@jetbrains/kotlin-web-site-ui/out/components/youtube-player';
// @ts-ignore
import YoutubePlaylist from '@webteam/youtube-playlist/lib';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know why, but types resolve doesn't work with it.

Comment on lines +66 to +71
if (useFallbackForInternalPackages) {
config.resolve.alias['@webteam'] = path.resolve(
__dirname,
'components/webteam-fallback'
);
}
Copy link
Collaborator Author

@nikpachoo nikpachoo Aug 14, 2025

Choose a reason for hiding this comment

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

this is the place, where all the magic happens.
We just resolve another module in case the env variable is set.

Comment on lines +1 to +19
import React, { FC } from 'react';

import YoutubePlayer from '@jetbrains/kotlin-web-site-ui/out/components/youtube-player';

interface YoutubePlaylistProps {
playlistId: string;
playlistTitle: string;
}

const YoutubePlaylist: FC<YoutubePlaylistProps> = ({ playlistId, playlistTitle }) => {
return (
<YoutubePlayer
mode={1}
id={playlistId}
/>
);
};

export default YoutubePlaylist;
Copy link
Collaborator Author

@nikpachoo nikpachoo Aug 14, 2025

Choose a reason for hiding this comment

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

Fallback component.
Initially I wanted to use a very simple one, only with a text, but then decided to use the player.
Not sure that this is needed.

@nikpachoo nikpachoo force-pushed the ktl-2944-playlist branch 3 times, most recently from ce4d1cd to 5a21005 Compare August 15, 2025 11:26
Comment on lines +18 to +29
transpiledPackages.push(
'@webteam/youtube-playlist',
'@webteam/ui-contexts',
'@webteam/colors',
'@webteam/toggle',
'@webteam/youtube-player',
'@webteam/use-fetch',
'@webteam/use-async-data',
'@webteam/bem-cn-fast',
'@webteam/list'
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not a workaround, it is expected to be here, we do the same with the RescUI components above.

@nikpachoo nikpachoo force-pushed the ktl-2944-playlist branch 3 times, most recently from 5605eb4 to 3e899b8 Compare August 15, 2025 15:37
'@webteam/list'
)
}

const withTranspile = nextTranspileModules(transpiledPackages);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably keep it for now, but I found out that next-transpile-modules is deprecated see https://github.com/martpie/next-transpile-modules/releases/tag/the-end

@nikpachoo nikpachoo closed this Aug 19, 2025
@nikpachoo nikpachoo reopened this Aug 19, 2025
@nikpachoo nikpachoo marked this pull request as draft August 19, 2025 13:52
Base automatically changed from ktl-2512-server-side-hero to master August 26, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants