ぼざクリタグ広場 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.
 
 
 
 
 
 

220 lines
5.9 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 Material = {
  44. id: number
  45. tag: Tag
  46. file: string | null
  47. url: string | null
  48. wikiPageBody?: string | null
  49. contentType: string | null
  50. createdAt: string
  51. createdByUser: { id: number; name: string }
  52. updatedAt: string
  53. updatedByUser: { id: number; name: string } }
  54. export type Menu = MenuItem[]
  55. export type MenuInvisibleItem = {
  56. name: ReactNode
  57. to?: string
  58. base?: string
  59. visible: false
  60. subMenu: SubMenuItem[] }
  61. export type MenuItem = MenuVisibleItem | MenuInvisibleItem
  62. export type MenuVisibleItem = {
  63. name: ReactNode
  64. to: string
  65. base?: string
  66. visible?: true
  67. subMenu: SubMenuItem[] }
  68. export type NicoTag = Tag & {
  69. category: 'nico'
  70. linkedTags: Tag[] }
  71. export type NiconicoMetadata = {
  72. currentTime: number
  73. duration: number
  74. isVideoMetaDataLoaded: boolean
  75. maximumBuffered: number
  76. muted: boolean
  77. showComment: boolean
  78. volume: number }
  79. export type NiconicoVideoInfo = {
  80. title: string
  81. videoId: string
  82. lengthInSeconds: number
  83. thumbnailUrl: string
  84. description: string
  85. viewCount: number
  86. commentCount: number
  87. mylistCount: number
  88. postedAt: string
  89. watchId: number }
  90. export type NiconicoViewerHandle = {
  91. play: () => void
  92. pause: () => void
  93. seek: (time: number) => void
  94. mute: () => void
  95. unmute: () => void
  96. setVolume: (volume: number) => void
  97. showComments: () => void
  98. hideComments: () => void }
  99. export type Post = {
  100. id: number
  101. url: string
  102. title: string
  103. thumbnail: string
  104. thumbnailBase: string
  105. tags: Tag[]
  106. viewed: boolean
  107. related: Post[]
  108. originalCreatedFrom: string | null
  109. originalCreatedBefore: string | null
  110. createdAt: string
  111. updatedAt: string
  112. uploadedUser: { id: number; name: string } | null }
  113. export type PostTagChange = {
  114. post: Post
  115. tag: Tag | null
  116. user: User | null
  117. changeType: 'add' | 'remove'
  118. timestamp: string }
  119. export type SubMenuComponentItem = {
  120. component: ReactNode
  121. visible: boolean }
  122. export type SubMenuItem = SubMenuComponentItem | SubMenuStringItem
  123. export type SubMenuStringItem = {
  124. name: ReactNode
  125. to: string
  126. visible?: boolean }
  127. export type Tag = {
  128. id: number
  129. name: string
  130. category: Category
  131. postCount: number
  132. createdAt: string
  133. updatedAt: string
  134. hasWiki: boolean
  135. materialId: number
  136. children?: Tag[]
  137. matchedAlias?: string | null }
  138. export type Theatre = {
  139. id: number
  140. name: string | null
  141. opensAt: string
  142. closesAt: string | null
  143. createdByUser: { id: number; name: string }
  144. createdAt: string
  145. updatedAt: string }
  146. export type TheatreComment = {
  147. theatreId: number,
  148. no: number,
  149. user: { id: number, name: string } | null
  150. content: string
  151. createdAt: string }
  152. export type User = {
  153. id: number
  154. name: string | null
  155. inheritanceCode: string
  156. role: UserRole }
  157. export type ViewFlagBehavior = typeof ViewFlagBehavior[keyof typeof ViewFlagBehavior]
  158. export type WikiPage = {
  159. id: number
  160. title: string
  161. createdUserId: number
  162. updatedUserId: number
  163. createdAt: string
  164. updatedAt: string
  165. body: string
  166. revisionId: number
  167. pred: number | null
  168. succ: number | null }
  169. export type WikiPageChange = {
  170. revisionId: number
  171. pred: number | null
  172. succ: null
  173. wikiPage: Pick<WikiPage, 'id' | 'title'>
  174. user: Pick<User, 'id' | 'name'>
  175. kind: 'content' | 'redirect'
  176. message: string | null
  177. timestamp: string }
  178. export type WikiPageDiff = {
  179. wikiPageId: number
  180. title: string
  181. olderRevisionId: number | null
  182. newerRevisionId: number
  183. diff: WikiPageDiffDiff[] }
  184. export type WikiPageDiffDiff = {
  185. type: 'context' | 'added' | 'removed'
  186. content: string }
  187. export type UserRole = typeof USER_ROLES[number]