このコミットが含まれているのは:
@@ -1,7 +1,9 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
|
||||
import { translateUIMessage } from '@/lib/i18n'
|
||||
import { apiGet } from '@/lib/api'
|
||||
|
||||
import type { LocaleCode } from '@/lib/locales'
|
||||
import type { CountField, CountsResource } from '@/lib/counts'
|
||||
|
||||
export type CountsAxis = { field: string; grain?: string }
|
||||
@@ -51,6 +53,23 @@ export const countsFieldLabel = (key: string): string => {
|
||||
}
|
||||
|
||||
|
||||
export const countsEventTypes = ['create', 'update', 'discard', 'restore'] as const
|
||||
|
||||
|
||||
export const countsAxisLabel = (
|
||||
axis: CountsAxis,
|
||||
definition: CountsDefinition,
|
||||
locale: LocaleCode,
|
||||
): { text: string; language: string } => {
|
||||
const field = translateUIMessage (countsFieldLabel (axis.field), 'counts', locale)
|
||||
if (axis.grain == null || definition.fields.find (item => item.key === axis.field)
|
||||
?.type !== 'datetime') return field
|
||||
return translateUIMessage ('axisWithGrain', 'counts', locale, {
|
||||
field: field.text,
|
||||
grain: translateUIMessage (`grains.${axis.grain}`, 'counts', locale).text })
|
||||
}
|
||||
|
||||
|
||||
export const countsAxisFields = (
|
||||
definition: CountsDefinition,
|
||||
history: boolean,
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする