-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Robert-M-Lucas/dev-SCRUM-66
Dev scrum 66
- Loading branch information
Showing
19 changed files
with
782 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {ReactNode} from "react"; | ||
import {transactionPoint} from "./graphs/GraphUtils.ts"; | ||
import {min} from "lodash"; | ||
|
||
type tsxContents = ReactNode; | ||
|
||
export class TileElement { | ||
private readonly graph?: transactionPoint[]; | ||
private readonly TSX?: () => tsxContents; | ||
public readonly cols: number; | ||
public readonly rows: number; | ||
|
||
private constructor(graph: transactionPoint[] | undefined, TSX: (() => tsxContents) | undefined, cols: number, rows: number) { | ||
this.graph = graph; | ||
this.TSX = TSX; | ||
this.cols = cols; | ||
this.rows = rows; | ||
} | ||
|
||
static newGraph(graph: transactionPoint[], cols: number, rows: number, maxCol: number): TileElement { | ||
return new TileElement(graph, undefined, min([cols, maxCol])!, rows); | ||
} | ||
static newTSX(TSX: () => tsxContents, cols: number, rows: number, maxCol: number): TileElement { | ||
return new TileElement(undefined, TSX, min([cols, maxCol])!, rows); | ||
} | ||
|
||
isGraph(): boolean { | ||
return typeof this.graph !== "undefined"; | ||
} | ||
|
||
forceGetGraph(): transactionPoint[] { | ||
return this.graph!; | ||
} | ||
forceGetTSX(): () => tsxContents { | ||
return this.TSX!; | ||
} | ||
} | ||
|
||
export type tileData = { d: TileElement; rows: number; cols: number }; | ||
|
||
export function getTileSize (tile: TileElement) { | ||
return {colSpan: tile.cols, rowSpan: tile.rows}; | ||
} |
Oops, something went wrong.