Skip to content

Commit

Permalink
Merge branch 'vitest' into add-vitest-to-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnei committed Oct 15, 2024
2 parents d6bef8c + e6347f1 commit a19324c
Show file tree
Hide file tree
Showing 9 changed files with 827 additions and 1,648 deletions.
2 changes: 1 addition & 1 deletion .github/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PUBLIC_URL=/editor-ui
export VITE_APP_SETTINGS_PATH="/ui/config/editor/editor-settings.toml"
npm run build

FILENAME="oc-editor-$(date --utc +%F).tar.gz"
FILENAME="oc-editor-$(date -u +%F).tar.gz"
cd build
TMP="$(mktemp)"
mv editor-settings.toml "$TMP"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-icla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Python module
run: pip install apereocla
run: pip install --break-system-packages apereocla

- name: Check Apereo ICLA for GitHub user
run: apereocla -g "${{ github.event.pull_request.user.login }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Wait for previous workflows to finish
uses: softprops/turnstyle@v1
uses: softprops/turnstyle@v2
with:
same-branch-only: false
env:
Expand Down
2,383 changes: 787 additions & 1,596 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource-variable/roboto-flex": "^5.0.15",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@fontsource-variable/roboto-flex": "^5.1.0",
"@iarna/toml": "^2.2.5",
"@mui/material": "^5.15.21",
"@opencast/appkit": "^0.3.0",
"@reduxjs/toolkit": "^2.2.6",
"@types/iarna__toml": "^2.0.5",
"@types/react": "^18.3.3",
"@mui/material": "^5.16.7",
"@opencast/appkit": "^0.3.1",
"@reduxjs/toolkit": "^2.2.7",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"deepmerge": "^4.3.1",
"emotion-normalize": "^11.0.1",
"final-form": "^4.20.10",
"i18next": "^23.11.5",
"i18next": "^23.16.0",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-chained-backend": "^4.6.2",
"i18next-resources-to-backend": "^1.2.1",
Expand All @@ -29,19 +28,20 @@
"react-dom": "^18.3.1",
"react-draggable": "^4.4.6",
"react-final-form": "^6.5.9",
"react-hotkeys-hook": "^4.5.0",
"react-i18next": "^14.1.2",
"react-hotkeys-hook": "^4.5.1",
"react-i18next": "^15.0.3",
"react-icons": "^4.12.0",
"react-indiana-drag-scroll": "^2.2.0",
"react-player": "git+https://[email protected]/Arnei/react-player.git#20fe6c061cf7d71d33d764b4a51c9b9bbb614bf6",
"react-player": "git+https://[email protected]/Arnei/react-player.git#b441d7aafe9b98745318103d9c93872a3ffc5da9",
"react-redux": "^9.1.2",
"react-resizable": "^3.0.5",
"react-select": "^5.8.0",
"react-select": "^5.8.1",
"react-virtualized-auto-sizer": "^1.0.24",
"react-window": "^1.8.10",
"redux": "^5.0.1",
"standardized-audio-context": "^25.3.72",
"typescript": "^5.5.2",
"smol-toml": "^1.2.2",
"standardized-audio-context": "^25.3.77",
"typescript": "^5.6.2",
"uuid": "^10.0.0",
"webvtt-parser": "^2.2.0"
},
Expand All @@ -66,23 +66,23 @@
},
"devDependencies": {
"@opencast/eslint-config-ts-react": "^0.2.0",
"@playwright/test": "^1.45.0",
"@types/lodash": "^4.17.6",
"@playwright/test": "^1.47.2",
"@types/lodash": "^4.17.10",
"@types/luxon": "^3.4.2",
"@types/react-beforeunload": "^2.1.5",
"@types/react-resizable": "^3.0.7",
"@types/react-virtualized-auto-sizer": "^1.0.4",
"@types/react-window": "^1.8.8",
"@types/uuid": "^10.0.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react": "^4.3.2",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react": "^7.37.0",
"eslint-plugin-react-hooks": "^4.6.2",
"jsdom": "^24.1.0",
"jsdom": "^25.0.1",
"use-resize-observer": "^9.1.0",
"vite": "^5.3.2",
"vite": "^5.4.8",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-svgr": "^4.2.0",
"vitest": "^1.6.0"
"vitest": "^2.1.1"
}
}
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Also does some global hotkey configuration
*/
import parseToml from "@iarna/toml/parse-string";
import { parse } from "smol-toml";
import deepmerge from "deepmerge";
import { Flavor } from "./types";

Expand Down Expand Up @@ -222,7 +222,7 @@ const loadContextSettings = async () => {
}

try {
return parseToml(await response.text());
return parse(await response.text());
} catch (e) {
console.error(`Could not parse "${settingsPath}" as TOML: `, e);
throw new SyntaxError(`Could not parse "${settingsPath}" as TOML: ${e}`);
Expand Down
6 changes: 3 additions & 3 deletions src/main/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Header() {
}

const LogoPicture: React.FC = () => {
const path = (filename:string) => import.meta.env.BASE_URL + filename;
const imgUrl = new URL("/public/opencast-editor.svg", import.meta.url).href;
return (
<div>
<picture css={{
Expand All @@ -101,8 +101,8 @@ const LogoPicture: React.FC = () => {
height: "calc(100% - 0.5px)",
},
}}>
<source srcSet={path("opencast-editor.svg")}></source>
<img src={path("opencast-editor.svg")} alt="Opencast Editor Logo"/>
<source srcSet={imgUrl}></source>
<img src={imgUrl} alt="Opencast Editor Logo"/>
</picture>
</div>
);
Expand Down
23 changes: 4 additions & 19 deletions src/main/SubtitleTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,24 +287,13 @@ const TimelineSubtitleSegment: React.FC<{
const onResizeAbsolute: ResizableProps["onResize"] = (_event, { size, handle }) => {
// Possible TODO: Find a way to stop resizing a segment beyond 0ms here instead of later
let newLeft = absoluteLeft;
let newTop = absoluteTop;
const deltaHeight = size.height - absoluteHeight;
const deltaWidth = size.width - absoluteWidth;
if (handle[0] === "n") {
newTop -= deltaHeight;
} else if (handle[0] === "s") {
newTop += deltaHeight;
}

if (handle[handle.length - 1] === "w") {
newLeft -= deltaWidth;
} else if (handle[handle.length - 1] === "e") {
newLeft += deltaWidth;
newLeft -= size.width - absoluteWidth;
}

setAbsoluteWidth(size.width);
setAbsoluteHeight(size.height);
setAbsoluteLeft(newLeft);
setAbsoluteTop(newTop);
};

// Update redux state based on the resize
Expand All @@ -323,7 +312,7 @@ const TimelineSubtitleSegment: React.FC<{
}
// if handle === right, update endTime
if (handle === "e") {
newEndTime = props.cue.endTime + timeDiff;
newEndTime = props.cue.endTime - timeDiff;
}

dispatchNewTimes(newStartTime, newEndTime);
Expand Down Expand Up @@ -407,11 +396,7 @@ const TimelineSubtitleSegment: React.FC<{
width={absoluteWidth}
onResize={onResizeAbsolute}
onResizeStop={onResizeStop}
// TODO: The "e" handle is currently NOT WORKING CORRECTLY!
// The errounous behaviour can already be seens with a minimal
// draggable + resizable example.
// Fix most likely requires changes in one of those modules
resizeHandles={["w"]}
resizeHandles={["w", "e"]}
>
<div css={segmentStyle} ref={nodeRef} onClick={onClick} className="prevent-drag-scroll">
<span css={textStyle}>{props.cue.text}</span>
Expand Down
9 changes: 6 additions & 3 deletions src/main/VideoPlayers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
setJumpTriggered,
selectJumpTriggered,
setCurrentlyAt,
selectVideos,
} from "../redux/videoSlice";

import ReactPlayer, { Config } from "react-player";
Expand Down Expand Up @@ -50,7 +51,9 @@ const VideoPlayers: React.FC<{
maxHeightInPixel = 300,
}) => {

const videoURLs = useAppSelector(selectVideoURL);
const videos = useAppSelector(selectVideos);
let primaryIndex = videos.findIndex(e => e.audio_stream.available === true);
primaryIndex = primaryIndex < 0 ? 0 : primaryIndex;
const videoCount = useAppSelector(selectVideoCount);

const videoPlayerAreaStyle = css({
Expand All @@ -71,8 +74,8 @@ const VideoPlayers: React.FC<{
<VideoPlayer
key={i}
dataKey={i}
url={videoURLs[i]}
isPrimary={i === 0}
url={videos[i].uri}
isPrimary={i === primaryIndex}
subtitleUrl={""}
first={i === 0}
last={i === videoCount - 1}
Expand Down

0 comments on commit a19324c

Please sign in to comment.