ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

186 lines
5.0 KiB

  1. import { CATEGORIES,
  2. FETCH_POSTS_ORDER_FIELDS,
  3. USER_ROLES,
  4. ViewFlagBehavior } from '@/consts'
  5. import type { ReactNode } from 'react'
  6. export type Category = typeof CATEGORIES[number]
  7. export type FetchPostsOrder = `${ FetchPostsOrderField }:${ 'asc' | 'desc' }`
  8. export type FetchPostsOrderField = typeof FETCH_POSTS_ORDER_FIELDS[number]
  9. export type FetchPostsParams = {
  10. url: string
  11. title: string
  12. tags: string
  13. match: 'all' | 'any'
  14. originalCreatedFrom: string
  15. originalCreatedTo: string
  16. createdFrom: string
  17. createdTo: string
  18. updatedFrom: string
  19. updatedTo: string
  20. page: number
  21. limit: number
  22. order: FetchPostsOrder }
  23. export type FetchTagsOrder = `${ FetchTagsOrderField }:${ 'asc' | 'desc' }`
  24. export type FetchTagsOrderField =
  25. | 'name'
  26. | 'category'
  27. | 'post_count'
  28. | 'created_at'
  29. | 'updated_at'
  30. export type FetchTagsParams = {
  31. post: number | null
  32. name: string
  33. category: Category | null
  34. postCountGTE: number
  35. postCountLTE: number | null
  36. createdFrom: string
  37. createdTo: string
  38. updatedFrom: string
  39. updatedTo: string
  40. page: number
  41. limit: number
  42. order: FetchTagsOrder }
  43. export type Menu = MenuItem[]
  44. export type MenuItem = {
  45. name: string
  46. to: string
  47. base?: string
  48. subMenu: SubMenuItem[] }
  49. export type NicoTag = Tag & {
  50. category: 'nico'
  51. linkedTags: Tag[] }
  52. export type NiconicoMetadata = {
  53. currentTime: number
  54. duration: number
  55. isVideoMetaDataLoaded: boolean
  56. maximumBuffered: number
  57. muted: boolean
  58. showComment: boolean
  59. volume: number }
  60. export type NiconicoVideoInfo = {
  61. title: string
  62. videoId: string
  63. lengthInSeconds: number
  64. thumbnailUrl: string
  65. description: string
  66. viewCount: number
  67. commentCount: number
  68. mylistCount: number
  69. postedAt: string
  70. watchId: number }
  71. export type NiconicoViewerHandle = {
  72. play: () => void
  73. pause: () => void
  74. seek: (time: number) => void
  75. mute: () => void
  76. unmute: () => void
  77. setVolume: (volume: number) => void
  78. showComments: () => void
  79. hideComments: () => void }
  80. export type Post = {
  81. id: number
  82. url: string
  83. title: string
  84. thumbnail: string
  85. thumbnailBase: string
  86. tags: Tag[]
  87. viewed: boolean
  88. related: Post[]
  89. originalCreatedFrom: string | null
  90. originalCreatedBefore: string | null
  91. createdAt: string
  92. updatedAt: string
  93. uploadedUser: { id: number; name: string } | null }
  94. export type PostTagChange = {
  95. post: Post
  96. tag: Tag | null
  97. user: User | null
  98. changeType: 'add' | 'remove'
  99. timestamp: string }
  100. export type SubMenuItem =
  101. | { component: ReactNode
  102. visible: boolean }
  103. | { name: string
  104. to: string
  105. visible?: boolean }
  106. export type Tag = {
  107. id: number
  108. name: string
  109. category: Category
  110. postCount: number
  111. createdAt: string
  112. updatedAt: string
  113. hasWiki: boolean
  114. children?: Tag[]
  115. matchedAlias?: string | null }
  116. export type Theatre = {
  117. id: number
  118. name: string | null
  119. opensAt: string
  120. closesAt: string | null
  121. createdByUser: { id: number; name: string }
  122. createdAt: string
  123. updatedAt: string }
  124. export type User = {
  125. id: number
  126. name: string | null
  127. inheritanceCode: string
  128. role: UserRole }
  129. export type ViewFlagBehavior = typeof ViewFlagBehavior[keyof typeof ViewFlagBehavior]
  130. export type WikiPage = {
  131. id: number
  132. title: string
  133. createdUserId: number
  134. updatedUserId: number
  135. createdAt: string
  136. updatedAt: string
  137. body: string
  138. revisionId: number
  139. pred: number | null
  140. succ: number | null }
  141. export type WikiPageChange = {
  142. revisionId: number
  143. pred: number | null
  144. succ: null
  145. wikiPage: Pick<WikiPage, 'id' | 'title'>
  146. user: Pick<User, 'id' | 'name'>
  147. kind: 'content' | 'redirect'
  148. message: string | null
  149. timestamp: string }
  150. export type WikiPageDiff = {
  151. wikiPageId: number
  152. title: string
  153. olderRevisionId: number | null
  154. newerRevisionId: number
  155. diff: WikiPageDiffDiff[] }
  156. export type WikiPageDiffDiff = {
  157. type: 'context' | 'added' | 'removed'
  158. content: string }
  159. export type UserRole = typeof USER_ROLES[number]