Merge remote-tracking branch 'jar0s/feature/radar-chart'
This commit is contained in:
32
src/model.ts
32
src/model.ts
@@ -1,3 +1,9 @@
|
||||
export enum HomepageOption {
|
||||
chart = "chart",
|
||||
columns = "columns",
|
||||
both = "both"
|
||||
}
|
||||
|
||||
export type ItemAttributes = {
|
||||
name: string;
|
||||
ring: string;
|
||||
@@ -6,7 +12,11 @@ export type ItemAttributes = {
|
||||
featured?: boolean;
|
||||
};
|
||||
|
||||
export type FlagType = "new" | "changed" | "default";
|
||||
export enum FlagType {
|
||||
new = 'new',
|
||||
changed = 'changed',
|
||||
default = 'default'
|
||||
}
|
||||
|
||||
export type Item = ItemAttributes & {
|
||||
featured: boolean;
|
||||
@@ -16,6 +26,14 @@ export type Item = ItemAttributes & {
|
||||
revisions: Revision[];
|
||||
};
|
||||
|
||||
export type Blip = Item & {
|
||||
quadrantPosition: number
|
||||
ringPosition: number
|
||||
colour: string
|
||||
txtColour: string
|
||||
coordinates: Point
|
||||
}
|
||||
|
||||
export type Revision = ItemAttributes & {
|
||||
body: string;
|
||||
fileName: string;
|
||||
@@ -26,6 +44,13 @@ export type Quadrant = {
|
||||
[name: string]: Item[];
|
||||
};
|
||||
|
||||
export type QuadrantConfig = {
|
||||
colour: string,
|
||||
txtColour: string,
|
||||
position: number,
|
||||
description: string
|
||||
}
|
||||
|
||||
export type Radar = {
|
||||
items: Item[];
|
||||
releases: string[];
|
||||
@@ -40,6 +65,11 @@ export const featuredOnly = (items: Item[]) =>
|
||||
export const nonFeaturedOnly = (items: Item[]) =>
|
||||
items.filter((item) => !item.featured);
|
||||
|
||||
export type Point = {
|
||||
x: number,
|
||||
y: number
|
||||
}
|
||||
|
||||
export const groupByQuadrants = (items: Item[]): Group =>
|
||||
items.reduce(
|
||||
(quadrants, item: Item) => ({
|
||||
|
||||
Reference in New Issue
Block a user