Skip to content

Commit c94c0ed

Browse files
authored
Merge pull request #94 from nebulabroadcast/93-rundown-edit
Experimental: Rundown editing in the web interface
2 parents aabaf0f + 6e5f054 commit c94c0ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2374
-1013
lines changed

backend/api/init/init_request.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ class InitResponseModel(ResponseModel):
7070
),
7171
] = None
7272

73-
experimental: Annotated[bool | None, Field(title="Enable experimental features")] = None
73+
experimental: Annotated[
74+
bool | None, Field(title="Enable experimental features")
75+
] = None
7476

7577

7678
class InitRequest(APIRequest):

backend/schema/meta-aliases-cs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
["source" , "Zdroj" , null , ""],
101101
["id_folder" , "Složka" , null , ""],
102102
["is_admin" , "Admin" , null , ""],
103-
["run_mode" , "Run mode" , null , "Režim odbavení příspěvků"],
103+
["run_mode" , "Režim" , "Režim" , "Režim odbavení příspěvků"],
104104
["summary" , "Perex" , null , ""],
105105
["description" , "Popis" , null , ""],
106106
["file/format" , "Formát souboru" , null , ""],

backend/schema/meta-aliases-en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
["source" , "Source" , null , ""],
101101
["id_folder" , "Folder" , null , ""],
102102
["is_admin" , "Admin" , null , ""],
103-
["run_mode" , "Run mode" , null , ""],
103+
["run_mode" , "Run mode" , "Mode" , ""],
104104
["summary" , "Summary" , null , ""],
105105
["description" , "Description" , null , ""],
106106
["file/format" , "File format" , null , ""],

frontend/src/actions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import nebula from '/src/nebula'
22
import { createSlice } from '@reduxjs/toolkit'
3+
import { isNaN } from 'lodash'
34

45
const initialState = {
56
browserRefresh: 0,
@@ -49,6 +50,7 @@ const contextSlice = createSlice({
4950
},
5051

5152
setFocusedAsset: (state, action) => {
53+
if (isNaN(action.payload)) return
5254
state.focusedAsset = action.payload
5355
},
5456

frontend/src/app.jsx

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useLocalStorage } from '/src/hooks'
66
import { Routes, Route, Navigate, BrowserRouter } from 'react-router-dom'
77

88
import WebsocketListener from '/src/websocket'
9-
import NavBar from '/src/containers/Navbar'
9+
import MainNavbar from '/src/containers/MainNavbar'
1010
import LoginPage from '/src/pages/LoginPage'
1111
import LoadingPage from '/src/pages/LoadingPage'
1212
import MAMPage from '/src/pages/MAMPage'
@@ -15,14 +15,12 @@ import ServicesPage from '/src/pages/ServicesPage'
1515
import ToolPage from '/src/pages/ToolPage'
1616
import ProfilePage from '/src/pages/ProfilePage'
1717
import UsersPage from '/src/pages/UsersPage'
18-
import Dropdown from '/src/components/Dropdown'
1918

2019
const App = () => {
2120
const [accessToken, setAccessToken] = useLocalStorage('accessToken', null)
2221
const [errorCode, setErrorCode] = useState(null)
2322
const [loading, setLoading] = useState(true)
2423
const [initData, setInitData] = useState(null)
25-
const [channels, setChannels] = useState([])
2624

2725
// Ensure server connection
2826

@@ -58,28 +56,9 @@ const App = () => {
5856
.finally(() => setLoading(false))
5957
}, [accessToken])
6058

61-
useEffect(() => {
62-
if (initData?.settings?.channels) {
63-
setChannels(initData.settings.channels)
64-
const mostRecentChannel = JSON.parse(
65-
localStorage.getItem('currentChannel')
66-
)
67-
if (mostRecentChannel) {
68-
setCurrentChannel(mostRecentChannel)
69-
} else if (initData.settings.channels.length > 0) {
70-
setCurrentChannel(initData.settings.channels[0])
71-
}
72-
}
73-
}, [initData])
74-
75-
const handleChannelChange = (channel) => {
76-
setCurrentChannel(channel)
77-
}
78-
7959
// Render
8060

8161
if (loading) return <LoadingPage />
82-
8362
if (errorCode > 401) return <main className="center">server unavailable</main>
8463

8564
if (!initData.installed)
@@ -92,7 +71,7 @@ const App = () => {
9271
<Suspense fallback={<LoadingPage />}>
9372
<WebsocketListener />
9473
<BrowserRouter>
95-
<NavBar />
74+
<MainNavbar />
9675
<Routes>
9776
<Route
9877
path="/"

frontend/src/components/ContextMenu.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const ContextMenuWrapper = styled.div`
88
99
background-color: var(--color-surface-02);
1010
min-width: 100px;
11-
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.4);
11+
box-shadow: 4px 4px 10px 4px rgba(0, 0, 0, 0.7);
1212
z-index: 1;
1313
1414
hr {
1515
margin: 0;
1616
border: none;
17-
border-top: 2px solid var(--color-surface-03);
17+
border-top: 2px solid var(--color-surface-05);
1818
}
1919
2020
button {

frontend/src/components/Dialog.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const Dialog = ({
8282
headerStyle,
8383
bodyStyle,
8484
footerStyle,
85+
open = true,
8586
}) => {
8687
const dialogRef = useRef(null)
8788

frontend/src/components/Dropdown.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import clsx from 'clsx'
55
const DropdownContainer = styled.div`
66
position: relative;
77
display: inline-block;
8+
z-index: 999;
89
910
.dropdown-content {
1011
display: none;
1112
position: absolute;
1213
background-color: var(--color-surface-02);
1314
min-width: 100px;
14-
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.4);
15+
box-shadow: 4px 4px 10px 4px rgba(0, 0, 0, 0.7);
1516
z-index: 1;
1617
1718
hr {

frontend/src/components/Form.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const Form = styled.div`
2121
min-width: 200px;
2222
max-width: 200px;
2323
padding-top: 0.5rem;
24+
user-select: none;
25+
user-drag: none;
2426
}
2527
2628
.form-control {

frontend/src/components/Progress.jsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useState, useEffect } from 'react'
12
import styled from 'styled-components'
23
import defaultTheme from './theme'
34

@@ -10,18 +11,36 @@ const BaseProgress = styled.div`
1011
1112
div {
1213
height: 100%;
13-
transition: width 0.3s linear;
1414
background: ${(props) => props.theme.colors.cyan};
15+
border-radius: ${(props) => props.theme.inputBorderRadius};
16+
transition: ${(props) =>
17+
props.disableTransition ? 'none' : 'width 0.3s linear'};
1518
}
1619
`
1720
BaseProgress.defaultProps = {
1821
theme: defaultTheme,
1922
}
2023

2124
const Progress = ({ value, ...props }) => {
25+
const [prevValue, setPrevValue] = useState(value)
26+
const [disableTransition, setDisableTransition] = useState(false)
27+
28+
useEffect(() => {
29+
if (value < prevValue) {
30+
setDisableTransition(true)
31+
} else {
32+
setDisableTransition(false)
33+
}
34+
setPrevValue(value)
35+
}, [value, prevValue])
36+
2237
return (
23-
<BaseProgress {...props}>
24-
<div style={{ width: `${value}%` }} />
38+
<BaseProgress {...props} disableTransition={disableTransition}>
39+
<div
40+
className="progress"
41+
style={{ width: `${value}%` }}
42+
key={disableTransition ? 'no-transition' : 'transition'}
43+
/>
2544
</BaseProgress>
2645
)
2746
}

0 commit comments

Comments
 (0)