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

234 lines
6.7 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 | null
  103. thumbnail: string | null
  104. thumbnailBase: string | null
  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 } | 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 PostVersion = {
  120. postId: number
  121. versionNo: number
  122. eventType: 'create' | 'update' | 'discard' | 'restore'
  123. title: { current: string | null; prev: string | null }
  124. url: { current: string; prev: string | null }
  125. thumbnail: { current: string | null; prev: string | null }
  126. thumbnailBase: { current: string | null; prev: string | null }
  127. tags: { name: string; type: 'context' | 'added' | 'removed' }[]
  128. originalCreatedFrom: { current: string | null; prev: string | null }
  129. originalCreatedBefore: { current: string | null; prev: string | null }
  130. createdAt: string
  131. createdByUser: { id: number; name: string | null } | null }
  132. export type SubMenuComponentItem = {
  133. component: ReactNode
  134. visible: boolean }
  135. export type SubMenuItem = SubMenuComponentItem | SubMenuStringItem
  136. export type SubMenuStringItem = {
  137. name: ReactNode
  138. to: string
  139. visible?: boolean }
  140. export type Tag = {
  141. id: number
  142. name: string
  143. category: Category
  144. postCount: number
  145. createdAt: string
  146. updatedAt: string
  147. hasWiki: boolean
  148. materialId: number
  149. children?: Tag[]
  150. matchedAlias?: string | null }
  151. export type Theatre = {
  152. id: number
  153. name: string | null
  154. opensAt: string
  155. closesAt: string | null
  156. createdByUser: { id: number; name: string }
  157. createdAt: string
  158. updatedAt: string }
  159. export type TheatreComment = {
  160. theatreId: number,
  161. no: number,
  162. user: { id: number, name: string } | null
  163. content: string
  164. createdAt: string }
  165. export type User = {
  166. id: number
  167. name: string | null
  168. inheritanceCode: string
  169. role: UserRole }
  170. export type ViewFlagBehavior = typeof ViewFlagBehavior[keyof typeof ViewFlagBehavior]
  171. export type WikiPage = {
  172. id: number
  173. title: string
  174. createdUserId: number
  175. updatedUserId: number
  176. createdAt: string
  177. updatedAt: string
  178. body: string
  179. revisionId: number
  180. pred: number | null
  181. succ: number | null }
  182. export type WikiPageChange = {
  183. revisionId: number
  184. pred: number | null
  185. succ: null
  186. wikiPage: Pick<WikiPage, 'id' | 'title'>
  187. user: Pick<User, 'id' | 'name'>
  188. kind: 'content' | 'redirect'
  189. message: string | null
  190. timestamp: string }
  191. export type WikiPageDiff = {
  192. wikiPageId: number
  193. title: string
  194. olderRevisionId: number | null
  195. newerRevisionId: number
  196. diff: WikiPageDiffDiff[] }
  197. export type WikiPageDiffDiff = {
  198. type: 'context' | 'added' | 'removed'
  199. content: string }
  200. export type UserRole = typeof USER_ROLES[number]