Skip to content

Commit ce4d1cd

Browse files
committed
KTL-2944 feat: add the youtube playlist
1 parent 5343558 commit ce4d1cd

File tree

8 files changed

+183
-12
lines changed

8 files changed

+183
-12
lines changed

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.yarnrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
registry "https://registry.npmjs.org/"
2+
save-prefix ""
3+
4+
"@webteam:registry" "https://packages.jetbrains.team/npm/p/wt/npm"
5+
"//packages.jetbrains.team/npm/p/wt/npm/:_authToken" "${WEBTEAM_UI_NPM_TOKEN1}"
6+
"//packages.jetbrains.team/npm/p/wt/npm/:always-auth" true

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,36 @@ You can:
139139
140140
## Local development
141141
142-
#### preliminaries: python3 installed
143-
142+
For full development tooling, you need to connect to the WebTeam registry.
143+
You can work without it, but some UI components will not be displayed.
144+
145+
#### Option 1: Connect to Space registry (recommended for full functionality)
146+
Visit [the registry](https://jetbrains.team/p/wt/packages/npm/npm) page in Space:
147+
- On the top right, click Connect;
148+
- Click Generate personal token;
149+
- Copy your personal token.
150+
Add your personal token to the environmental variable. This step differs based on your OS.
151+
152+
##### For macOS:
153+
Add your token to the ~/.zshenv file:
154+
- Open the Terminal;
155+
- Use this command to access .zshenv file `nano ~/.zshenv`;
156+
- Replace your_token with your actual Space token and use this command to add an environment variable: `export WEBTEAM_UI_NPM_TOKEN=yourtoken`.
157+
158+
Then install frontend dependencies `yarn install`.
159+
160+
#### Option 2: Ignore optional dependecies
161+
162+
Add an environment variable `export USE_FALLBACK_FOR_INTERNAL_PACKAGES=1`.
163+
Then install npm dependencies without optional ones:
164+
```bash
165+
yarn run install:ignore-optional
144166
```
145-
# install frontend dependencies
146-
yarn install
147167

168+
### Buld the website
169+
preliminaries: python3 installed
170+
171+
```
148172
# at first start you need to build the static
149173
yarn run next-build-static
150174

blocks/server-side/additional-materials/additional-materials.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import cn from 'classnames';
55
import styles from './additional-materials.module.css';
66
import { useTextStyles } from '@rescui/typography';
77

8-
import YoutubePlayer from '@jetbrains/kotlin-web-site-ui/out/components/youtube-player';
8+
// @ts-ignore
9+
import YoutubePlaylist from '@webteam/youtube-playlist/lib';
910

1011
export const AdditionalMaterials: FC = ({}) => {
1112

@@ -25,11 +26,10 @@ export const AdditionalMaterials: FC = ({}) => {
2526
</h3>
2627

2728
<div className="ktl-row">
28-
<div className="ktl-col-12 ktl-col-md-8">
29-
<YoutubePlayer
30-
mode={1}
31-
id="PLlFc5cFwUnmx-dpq9nkdaVJX0GnrM1Mp1"
32-
previewImgSrc="https://img.youtube.com/vi/0URxGa3q3tY/maxresdefault.jpg"
29+
<div className="ktl-col-12">
30+
<YoutubePlaylist
31+
playlistId="PLlFc5cFwUnmx-dpq9nkdaVJX0GnrM1Mp1"
32+
playlistTitle="Server-Side Development with Kotlin"
3333
/>
3434
</div>
3535
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, { FC } from 'react';
2+
3+
import YoutubePlayer from '@jetbrains/kotlin-web-site-ui/out/components/youtube-player';
4+
5+
interface YoutubePlaylistProps {
6+
playlistId: string;
7+
playlistTitle: string;
8+
}
9+
10+
const YoutubePlaylist: FC<YoutubePlaylistProps> = ({ playlistId, playlistTitle }) => {
11+
return (
12+
<YoutubePlayer
13+
mode={1}
14+
id={playlistId}
15+
/>
16+
);
17+
};
18+
19+
export default YoutubePlaylist;

next.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require('path');
12
const packageJSON = require('./package.json');
23

34
const withPlugins = require('next-compose-plugins');
@@ -13,6 +14,20 @@ let transpiledPackages = [
1314
'@rescui/menu'
1415
];
1516

17+
if (process.env.USE_FALLBACK_FOR_INTERNAL_PACKAGES !== '1') {
18+
transpiledPackages.push(
19+
'@webteam/youtube-playlist',
20+
'@webteam/ui-contexts',
21+
'@webteam/colors',
22+
'@webteam/toggle',
23+
'@webteam/youtube-player',
24+
'@webteam/use-fetch',
25+
'@webteam/use-async-data',
26+
'@webteam/bem-cn-fast',
27+
'@webteam/list'
28+
)
29+
}
30+
1631
const withTranspile = nextTranspileModules(transpiledPackages);
1732

1833
const nextConfig = {
@@ -44,6 +59,17 @@ const nextConfig = {
4459
type: 'asset/source'
4560
});
4661

62+
const useFallbackForInternalPackages = process.env.USE_FALLBACK_FOR_INTERNAL_PACKAGES === '1';
63+
64+
config.resolve.alias = config.resolve.alias || {};
65+
66+
if (useFallbackForInternalPackages) {
67+
config.resolve.alias['@webteam'] = path.resolve(
68+
__dirname,
69+
'components/webteam-fallback'
70+
);
71+
}
72+
4773
return config;
4874
},
4975
};

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,17 @@
107107
"webpack-dev-server": "^4.3.1",
108108
"yaml-loader": "0.7.0"
109109
},
110+
"optionalDependencies": {
111+
"@webteam/ui-contexts": "0.10.10",
112+
"@webteam/youtube-playlist": "1.8.3"
113+
},
110114
"resolutions": {
111115
"sharp": "^0.28.3"
112116
},
113117
"scripts": {
114118
"build": "yarn run build:production && yarn run next-build-static",
115119
"build:production": "NODE_ENV=production webpack --mode production",
120+
"install:ignore-optional": "yarn install --ignore-optional",
116121
"postinstall": "cd node_modules/codemirror && rollup -c",
117122
"start": "webpack serve",
118123
"next-dev": "next dev",

yarn.lock

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,85 @@
25662566
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e"
25672567
integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==
25682568

2569+
"@webteam/bem-cn-fast@^1.1.6":
2570+
version "1.1.6"
2571+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/bem-cn-fast/-/bem-cn-fast-1.1.6.tgz#2ef71bfea950cda6d10c58cae2cad0ab58ce301e"
2572+
integrity sha512-hoyc4MkY/6MgmoGDduGhFxfmqsSNYbB0pK5ApXcG0qgxmkgkHGQ+5ExSaHh80lDJ5/UpGDSanhaafqWHvR1CUw==
2573+
dependencies:
2574+
bem-cn-fast "^1.0.2"
2575+
2576+
"@webteam/colors@^1.0.42":
2577+
version "1.0.42"
2578+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/colors/-/colors-1.0.42.tgz#89b0c014de0a9e526a983cd9f374b4ba1f1aab18"
2579+
integrity sha512-55KOdUkkKS9x6mtQ2//uEx5QKUY6CQZK+dE/Pr+5dH5o/KzSFjgXpBRYhugBqgghV0hoUqe18pwocKQj814RmA==
2580+
2581+
"@webteam/list@^5.2.4":
2582+
version "5.2.4"
2583+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/list/-/list-5.2.4.tgz#1dac1f49f7666682927c94dfcfd9d70ebd933e03"
2584+
integrity sha512-T6WqDCR8MZqzfNZSb+ehcEGkIn+3vZkTN3oVATNCxxZZ/XnmVKrmh4kP0PJtsQ6LcR+bEppDMoRv0J4TtUFwdg==
2585+
dependencies:
2586+
"@babel/runtime-corejs3" "^7.11.0"
2587+
"@webteam/bem-cn-fast" "^1.1.6"
2588+
classnames "^2.2.6"
2589+
core-js "^3"
2590+
2591+
"@webteam/toggle@^2.2.4":
2592+
version "2.2.4"
2593+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/toggle/-/toggle-2.2.4.tgz#574124a42fa535eab3179c3f5c7f06fb2582e394"
2594+
integrity sha512-cLkXqgyYQXdq9gAqxr4ASBOIPKHfIeOLxNDdFj+KwZ88ATX/fz6pE5eplID++5Z856nB7m/iRYeW8rqpTyjF/Q==
2595+
dependencies:
2596+
"@babel/runtime-corejs3" "^7.11.0"
2597+
"@webteam/bem-cn-fast" "^1.1.6"
2598+
"@webteam/list" "^5.2.4"
2599+
classnames "^2.2.6"
2600+
core-js "^3"
2601+
2602+
"@webteam/[email protected]":
2603+
version "0.10.10"
2604+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/ui-contexts/-/ui-contexts-0.10.10.tgz#01e356a3ee43933040d86046350b7ae095d6ae3e"
2605+
integrity sha512-xmNwQ/HngYpmWDkITpqZuoQa0P0SvIDLt5ZfHzcFNP7kA3q/cPoNB7EMUK+NQ05tj2fvXgbH36+m2YhtsdB+LA==
2606+
dependencies:
2607+
"@babel/runtime-corejs3" "^7.11.0"
2608+
"@webteam/colors" "^1.0.42"
2609+
core-js "^3"
2610+
2611+
"@webteam/use-async-data@^0.4.0":
2612+
version "0.4.0"
2613+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/use-async-data/-/use-async-data-0.4.0.tgz#8b0cc32585d7eb17102a1076e6a357b47b3c3fcb"
2614+
integrity sha512-WYObCgGBj3K1691sq9Js4u0K1C5fj49Y2+oFSz7YlsTyLvBMTVcncQGlep3M9XV4Cj+/cpD5lo+QgL+FlNC4cQ==
2615+
dependencies:
2616+
swr "^2.3.0"
2617+
2618+
"@webteam/use-fetch@^0.5.0":
2619+
version "0.5.0"
2620+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/use-fetch/-/use-fetch-0.5.0.tgz#e6a3243a09b60e9bd510bd40c964aee80d26871f"
2621+
integrity sha512-Zrofsip7mT60xzntxu433Ohfttkf4RsMjX4/HcVAE43LQF5P71gsmLfu7lw7gASAkzsCOfP4lMNAY9AzqeT5pg==
2622+
dependencies:
2623+
"@webteam/use-async-data" "^0.4.0"
2624+
2625+
"@webteam/youtube-player@^0.13.0":
2626+
version "0.13.0"
2627+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/youtube-player/-/youtube-player-0.13.0.tgz#6d2850e42aef62f00699f4dbf98c5ce5baa581ed"
2628+
integrity sha512-T1lCMJEaJ78gxHK+MiR7MmUq4WPw7K5+Vuh9JCBHfCAaJfgSQvkINSdtdVYIKeMGHnr5yJhIPdTzBsVvvfTyYg==
2629+
dependencies:
2630+
"@babel/runtime-corejs3" "^7.11.0"
2631+
bem-cn-fast "^1.0.2"
2632+
classnames "^2.2.6"
2633+
core-js "^3"
2634+
2635+
"@webteam/[email protected]":
2636+
version "1.8.3"
2637+
resolved "https://packages.jetbrains.team/npm/p/wt/npm/@webteam/youtube-playlist/-/youtube-playlist-1.8.3.tgz#6de3849efeb44de44c1657dcd02a08cdbd510b49"
2638+
integrity sha512-LcMWfkINU5oZp9GC+pzKUPRg4Wq4ciVcCSXl8fUJ2H18R9pwHqQtGzjcLeDrG15++VYM1M/GzGjsOkBLZO5yig==
2639+
dependencies:
2640+
"@babel/runtime-corejs3" "^7.11.0"
2641+
"@webteam/toggle" "^2.2.4"
2642+
"@webteam/use-fetch" "^0.5.0"
2643+
"@webteam/youtube-player" "^0.13.0"
2644+
bem-cn-fast "^1.0.2"
2645+
classnames "^2.2.6"
2646+
core-js "^3"
2647+
25692648
"@xtuc/ieee754@^1.2.0":
25702649
version "1.2.0"
25712650
resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790"
@@ -3875,7 +3954,7 @@ depd@~1.1.2:
38753954
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
38763955
integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==
38773956

3878-
dequal@^2.0.0:
3957+
dequal@^2.0.0, dequal@^2.0.3:
38793958
version "2.0.3"
38803959
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be"
38813960
integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==
@@ -7996,6 +8075,14 @@ svgo@^2.2.0:
79968075
picocolors "^1.0.0"
79978076
stable "^0.1.8"
79988077

8078+
swr@^2.3.0:
8079+
version "2.3.6"
8080+
resolved "https://registry.npmjs.org/swr/-/swr-2.3.6.tgz#5fee0ee8a0762a16871ee371075cb09422b64f50"
8081+
integrity sha512-wfHRmHWk/isGNMwlLGlZX5Gzz/uTgo0o2IRuTMcf4CPuPFJZlq0rDaKUx+ozB5nBOReNV1kiOyzMfj+MBMikLw==
8082+
dependencies:
8083+
dequal "^2.0.3"
8084+
use-sync-external-store "^1.4.0"
8085+
79998086
tapable@^2.1.1, tapable@^2.2.0:
80008087
version "2.2.1"
80018088
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
@@ -8345,6 +8432,11 @@ use-sidecar@^1.1.2:
83458432
detect-node-es "^1.1.0"
83468433
tslib "^2.0.0"
83478434

8435+
use-sync-external-store@^1.4.0:
8436+
version "1.5.0"
8437+
resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz#55122e2a3edd2a6c106174c27485e0fd59bcfca0"
8438+
integrity sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==
8439+
83488440
util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
83498441
version "1.0.2"
83508442
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"

0 commit comments

Comments
 (0)