このコミットが含まれているのは:
@@ -37,11 +37,12 @@ type Props = {
|
||||
height: number
|
||||
style?: CSSProperties
|
||||
onLoadComplete?: (info: NiconicoVideoInfo) => void
|
||||
onMetadataChange?: (meta: NiconicoMetadata) => void }
|
||||
onMetadataChange?: (meta: NiconicoMetadata) => void
|
||||
onError?: (data: unknown) => void }
|
||||
|
||||
|
||||
export default forwardRef ((props: Props, ref: ForwardedRef<NiconicoViewerHandle>) => {
|
||||
const { id, width, height, style = { }, onLoadComplete, onMetadataChange } = props
|
||||
const { id, width, height, style = { }, onLoadComplete, onMetadataChange, onError } = props
|
||||
|
||||
const iframeRef = useRef<HTMLIFrameElement> (null)
|
||||
const playerId = useMemo (() => `nico-${ id }-${ Math.random ().toString (36).slice (2) }`, [id])
|
||||
@@ -173,13 +174,16 @@ export default forwardRef ((props: Props, ref: ForwardedRef<NiconicoViewerHandle
|
||||
}
|
||||
|
||||
if (data.eventName === 'error')
|
||||
console.error ('niconico player error:', data)
|
||||
{
|
||||
console.error ('niconico player error:', data)
|
||||
onError?.(data)
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener ('message', onMessage)
|
||||
|
||||
return () => removeEventListener ('message', onMessage)
|
||||
}, [onLoadComplete, onMetadataChange, playerId])
|
||||
}, [onError, onLoadComplete, onMetadataChange, playerId])
|
||||
|
||||
useLayoutEffect (() => {
|
||||
if (!(fullScreen))
|
||||
|
||||
@@ -13,10 +13,11 @@ type Props = {
|
||||
ref?: RefObject<NiconicoViewerHandle | null>
|
||||
post: Post
|
||||
onLoadComplete?: (info: NiconicoVideoInfo) => void
|
||||
onMetadataChange?: (meta: NiconicoMetadata) => void }
|
||||
onMetadataChange?: (meta: NiconicoMetadata) => void
|
||||
onError?: (data: unknown) => void }
|
||||
|
||||
|
||||
const PostEmbed: FC<Props> = ({ ref, post, onLoadComplete, onMetadataChange }) => {
|
||||
const PostEmbed: FC<Props> = ({ ref, post, onLoadComplete, onMetadataChange, onError }) => {
|
||||
const dialogue = useDialogue ()
|
||||
const [framed, setFramed] = useState (false)
|
||||
|
||||
@@ -39,7 +40,8 @@ const PostEmbed: FC<Props> = ({ ref, post, onLoadComplete, onMetadataChange }) =
|
||||
width={640}
|
||||
height={360}
|
||||
onLoadComplete={onLoadComplete}
|
||||
onMetadataChange={onMetadataChange}/>)
|
||||
onMetadataChange={onMetadataChange}
|
||||
onError={onError}/>)
|
||||
}
|
||||
|
||||
case 'twitter.com':
|
||||
|
||||
@@ -128,8 +128,12 @@ const TopNav: FC<Props> = ({ user }) => {
|
||||
|
||||
const menu = menuOutline ({ tag, wikiId, user, pathName: location.pathname })
|
||||
const visibleMenu = menu.filter ((item): item is MenuVisibleItem => item.visible ?? true)
|
||||
const moreMenu = menu.filter (item =>
|
||||
!(item.visible ?? true)
|
||||
|| item.subMenu.filter (subItem => subItem.visible ?? true).length > 0)
|
||||
const activeIdx =
|
||||
visibleMenu.findIndex (item => location.pathname.startsWith (item.base || item.to))
|
||||
const submenuHeight = moreVsbl ? 40 * moreMenu.length : (activeIdx < 0 ? 0 : 40)
|
||||
|
||||
const prevActiveIdxRef = useRef<number> (activeIdx)
|
||||
|
||||
@@ -240,9 +244,9 @@ const TopNav: FC<Props> = ({ user }) => {
|
||||
<motion.div
|
||||
key="submenu-shell"
|
||||
layout
|
||||
className="relative hidden md:block overflow-hidden
|
||||
className="relative z-20 hidden md:block overflow-hidden
|
||||
bg-yellow-200 dark:bg-red-950"
|
||||
style={{ height: moreVsbl ? 40 * menu.length : (activeIdx < 0 ? 0 : 40) }}
|
||||
animate={{ height: submenuHeight }}
|
||||
onMouseLeave={() => {
|
||||
if (moreVsbl)
|
||||
setMoreVsbl (false)
|
||||
@@ -253,7 +257,7 @@ const TopNav: FC<Props> = ({ user }) => {
|
||||
}}>
|
||||
{moreVsbl
|
||||
? (
|
||||
menu.map ((item, i) => (
|
||||
moreMenu.map ((item, i) => (
|
||||
<div key={i} className="relative h-[40px]">
|
||||
<div className="absolute inset-0 flex items-center px-3">
|
||||
<motion.div
|
||||
|
||||
@@ -64,11 +64,14 @@ export const apiPatch = async <T> (
|
||||
): Promise<T> => apiP ('patch', path, body, opt)
|
||||
|
||||
|
||||
export const apiDelete = async (
|
||||
export const apiDelete = async <T = void> (
|
||||
path: string,
|
||||
opt?: Opt,
|
||||
): Promise<void> => {
|
||||
await client.delete (path, withUserCode (opt))
|
||||
): Promise<T> => {
|
||||
const res = await client.delete (path, withUserCode (opt))
|
||||
if (res.data == null || res.data === '')
|
||||
return undefined as T
|
||||
return toCamel (res.data as Record<string, unknown>, { deep: true }) as T
|
||||
}
|
||||
|
||||
|
||||
|
||||
ファイル差分が大きすぎるため省略します
差分を読込み
+42
-2
@@ -226,7 +226,7 @@ export type Theatre = {
|
||||
export type TheatreComment =
|
||||
| { theatreId: number
|
||||
no: number
|
||||
deteled: false
|
||||
deleted: false
|
||||
user: { id: number, name: string } | null
|
||||
content: string
|
||||
createdAt: string }
|
||||
@@ -234,7 +234,7 @@ export type TheatreComment =
|
||||
no: number
|
||||
deleted: true
|
||||
user: { id: number, name: string } | null
|
||||
content null,
|
||||
content: null,
|
||||
createdAt: string }
|
||||
|
||||
export type TheatreProgramme = {
|
||||
@@ -243,6 +243,46 @@ export type TheatreProgramme = {
|
||||
post: Post
|
||||
createdAt: string }
|
||||
|
||||
export type TheatreSkipVoteStatus = {
|
||||
votesCount: number
|
||||
requiredCount: number
|
||||
watchingUsersCount: number
|
||||
voted: boolean }
|
||||
|
||||
export type TheatreInfo = {
|
||||
hostFlg: boolean
|
||||
postId: number | null
|
||||
postStartedAt: string | null
|
||||
postElapsedMs: number | null
|
||||
watchingUsers: Pick<User, 'id' | 'name'>[]
|
||||
skipVote: TheatreSkipVoteStatus
|
||||
skipped?: boolean }
|
||||
|
||||
export type TheatreSkipEvent = {
|
||||
id: number
|
||||
theatreId: number
|
||||
post: Post
|
||||
skippedByUser: Pick<User, 'id' | 'name'>
|
||||
voters: Pick<User, 'id' | 'name'>[]
|
||||
tags: Tag[]
|
||||
programmePosition: number | null
|
||||
createdAt: string }
|
||||
|
||||
export type TheatrePostWeight = {
|
||||
post: Post
|
||||
weight: number
|
||||
penalty: number
|
||||
tags: Tag[] }
|
||||
|
||||
export type TheatreTagPenalty = {
|
||||
tag: Tag
|
||||
penalty: number }
|
||||
|
||||
export type TheatrePostSelectionWeights = {
|
||||
tagPenalties: TheatreTagPenalty[]
|
||||
lightestPosts: TheatrePostWeight[]
|
||||
heaviestPosts: TheatrePostWeight[] }
|
||||
|
||||
export type User = {
|
||||
id: number
|
||||
name: string | null
|
||||
|
||||
新しい課題から参照
ユーザをブロックする