categorys and titles for images
This commit is contained in:
parent
8abbb13fcc
commit
239c879649
22 changed files with 964 additions and 86 deletions
|
|
@ -8,8 +8,11 @@ export type EncodedPlayer = Array<any>
|
|||
export type EncodedPiece = Array<any>
|
||||
export type EncodedPieceShape = number
|
||||
|
||||
// TODO: maybe something other than string in the future
|
||||
export type Category = string
|
||||
export interface Category {
|
||||
id: number
|
||||
slug: string
|
||||
title: string
|
||||
}
|
||||
|
||||
interface GameRng {
|
||||
obj: Rng
|
||||
|
|
@ -26,10 +29,13 @@ interface Game {
|
|||
}
|
||||
|
||||
export interface Image {
|
||||
id: number
|
||||
filename: string
|
||||
file: string
|
||||
url: string
|
||||
category: Category
|
||||
title: string
|
||||
categories: Array<Category>
|
||||
created: number
|
||||
}
|
||||
|
||||
export interface GameSettings {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@ import { EncodedPiece, EncodedPieceShape, EncodedPlayer, Piece, PieceShape, Play
|
|||
import { Point } from './Geometry'
|
||||
import { Rng } from './Rng'
|
||||
|
||||
const slug = (str: string) => {
|
||||
let tmp = str.toLowerCase()
|
||||
tmp = tmp.replace(/[^a-z0-9]+/g, '-')
|
||||
tmp = tmp.replace(/^-|-$/, '')
|
||||
return tmp
|
||||
}
|
||||
|
||||
const pad = (x: any, pad: string) => {
|
||||
const str = `${x}`
|
||||
|
|
@ -162,6 +168,7 @@ function asQueryArgs(data: any) {
|
|||
|
||||
export default {
|
||||
hash,
|
||||
slug,
|
||||
uniqId,
|
||||
|
||||
encodeShape,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue