fix: sync program status updates
This commit is contained in:
1 parent
ed62d42a63
commit
38bcbfc697
4 files changed
+38
-3
No files matched your search
@@ -205,6 +205,7 @@ async def catalog_events(request: Request, db: AsyncSession = Depends(get_db)):
|
|||||||
async def events():
|
async def events():
|
||||||
previous = None
|
previous = None
|
||||||
while not await request.is_disconnected():
|
while not await request.is_disconnected():
|
||||||
|
db.expire_all()
|
||||||
streams = await StreamService(db).get_public_streams()
|
streams = await StreamService(db).get_public_streams()
|
||||||
payload = json.dumps(
|
payload = json.dumps(
|
||||||
[_serialize(stream, include_private=False) for stream in streams],
|
[_serialize(stream, include_private=False) for stream in streams],
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Component, lazy, Suspense, useState, useEffect, type ErrorInfo, type ReactNode } from 'react'
|
import { Component, lazy, Suspense, useState, useEffect, type ErrorInfo, type ReactNode } from 'react'
|
||||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
import { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom'
|
||||||
import { Button, ConfigProvider, Result } from 'antd'
|
import { Button, ConfigProvider, Result } from 'antd'
|
||||||
import zhCN from 'antd/locale/zh_CN'
|
import zhCN from 'antd/locale/zh_CN'
|
||||||
import theme from './theme/anthropic'
|
import theme from './theme/anthropic'
|
||||||
|
import './pageTransitions.css'
|
||||||
import { BrandProvider, useBrand } from './brand/BrandContext'
|
import { BrandProvider, useBrand } from './brand/BrandContext'
|
||||||
import { verifyToken } from './api/auth'
|
import { verifyToken } from './api/auth'
|
||||||
import { getToken } from './api/client'
|
import { getToken } from './api/client'
|
||||||
@@ -60,6 +61,8 @@ function AdminGuard({ children }: { children: React.ReactNode }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function AppRoutes() {
|
function AppRoutes() {
|
||||||
|
const location = useLocation()
|
||||||
|
const routeTransitionKey = location.pathname.startsWith('/admin') ? '/admin' : location.pathname
|
||||||
const { brand } = useBrand()
|
const { brand } = useBrand()
|
||||||
useEffect(() => { document.title = brand.brand_name }, [brand.brand_name])
|
useEffect(() => { document.title = brand.brand_name }, [brand.brand_name])
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Suspense, useEffect, useState } from 'react'
|
import { Suspense, useEffect, useState } from 'react'
|
||||||
import { Outlet, useNavigate, useLocation } from 'react-router-dom'
|
import { Outlet, useNavigate, useLocation , useOutlet } from 'react-router-dom'
|
||||||
import { Layout, Menu, Button, Typography } from 'antd'
|
import { Layout, Menu, Button, Typography } from 'antd'
|
||||||
import {
|
import {
|
||||||
DashboardOutlined, VideoCameraOutlined, PlusOutlined, MonitorOutlined,
|
DashboardOutlined, VideoCameraOutlined, PlusOutlined, MonitorOutlined,
|
||||||
@@ -35,6 +35,7 @@ export default function AdminLayout() {
|
|||||||
const [collapsed, setCollapsed] = useState(false)
|
const [collapsed, setCollapsed] = useState(false)
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
|
const outlet = useOutlet()
|
||||||
|
|
||||||
const selectedKey = menuItems.find(
|
const selectedKey = menuItems.find(
|
||||||
item => location.pathname === item.key || (location.pathname === '/' && item.key === '/admin')
|
item => location.pathname === item.key || (location.pathname === '/' && item.key === '/admin')
|
||||||
@@ -78,7 +79,9 @@ export default function AdminLayout() {
|
|||||||
<Button type="text" icon={<LogoutOutlined />} onClick={handleLogout}>退出登录</Button>
|
<Button type="text" icon={<LogoutOutlined />} onClick={handleLogout}>退出登录</Button>
|
||||||
</Header>
|
</Header>
|
||||||
<Content style={{ padding: 40, overflow: 'auto' }}>
|
<Content style={{ padding: 40, overflow: 'auto' }}>
|
||||||
<Outlet />
|
<div className="admin-page-transition" key={location.pathname}>
|
||||||
|
{outlet}
|
||||||
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
.app-route-transition,
|
||||||
|
.admin-page-transition {
|
||||||
|
min-height: 100%;
|
||||||
|
animation: page-fade-slide-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||||
|
will-change: opacity, transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-page-transition {
|
||||||
|
transform-origin: top center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes page-fade-slide-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(14px) scale(0.995);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0) scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.app-route-transition,
|
||||||
|
.admin-page-transition {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user