repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
miguelcjalmeida/vagante-dsmod
src/transformators/character-selection.ts
<filename>src/transformators/character-selection.ts<gh_stars>1-10 import { IRoomContext, IRoomBlock } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { EntityTypes, ItemTypes, ChestTypes } from '../rooms/types' import { findRoomEntities } from '../...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-yuria-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { IEquipmentProfile, EquipmentSubType, EquipmentType } from '../../item-builder/equipment-profile' import { improv...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-karla-items.ts
import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' ...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/set-merchant.ts
<filename>src/transformators/merchant-replacer/set-merchant.ts import { IRoomBlock } from '../../rooms/context' import { IShopEntity, IItemEntity, IEntity } from '../../rooms/entities' import { Merchant } from './merchant-profile' import { addLabel } from '../../manipulators/add-label' import { uniqueId } from '../../t...
miguelcjalmeida/vagante-dsmod
src/manipulators/add-item-into-treasure.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { IEntity, IItemEntity, IChestEntity } from '../rooms/entities' import { EntityTypes, ItemTypes } from '../rooms/types' import { uniqueId } from '../tools/unique-id' export const addItemIntoTreasure = (nest: IEntity[], treasure: IChestEntity, item: ITreasu...
miguelcjalmeida/vagante-dsmod
src/install.ts
<reponame>miguelcjalmeida/vagante-dsmod<filename>src/install.ts import { installMod } from './modder/install-mod' installMod()
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-patches-items.ts
import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { EntityTypes, ItemTypes } from '../../rooms/types' import { nextEquipmentPicker } from '../../item-builder/next-equipment-picker' import { IEquipmentProfile } from '../../item-builder/equip...
miguelcjalmeida/vagante-dsmod
src/transformators/room-instances.ts
import { IRoomContext, IRoom } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { deepClone } from '../tools/deep-clone' export const roomInstances = (context: IRoomContext) => { multiplyRooms(context, RoomNames.ACT_ONE, 3) multiplyRooms(contex...
miguelcjalmeida/vagante-dsmod
src/transformators/versioning.ts
import { IRoomContext } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { findRoomEntities } from '../finders/find-room-entities' import { EntityTypes } from '../rooms/types' import { IHoverText } from '../rooms/hovertext' import { config } from '....
miguelcjalmeida/vagante-dsmod
src/rooms/context.ts
<gh_stars>1-10 import { IEntity } from './entities' export interface IRoomContext { acts: IRoomAct[] act_specifications: IActSpecification[] } export interface IRoomAct { _comment: string rooms: IRooms } export interface IActSpecification { _comment: string width: number height: number } export interf...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/scenes/default-merchant-scene.ts
import { IShopEntity, IEntity } from '../../../rooms/entities' import { createUniqueLotteryPicker } from '../../../tools/create-unique-lottery-picker' import { andreBuilder, lenigrastBuilder, yoelBuilder, siegwardBuilder, patchesBuilder, greiratBuilder, handmaidBuilder, orbeckBuilder, } fro...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-irina-items.ts
import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' ...
miguelcjalmeida/vagante-dsmod
src/manipulators/find-room.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IRoomContext } from '../rooms/context' export const findRoom = (ctx: IRoomContext, uid: string) => { for (const i in ctx.acts) { const act = ctx.acts[i] const rooms = act.rooms for (const j in rooms) { const room = rooms[j] for (const k...
miguelcjalmeida/vagante-dsmod
src/manipulators/next-item-factory.ts
export const nextItemFactory = <T>(list: T[], onNextItemReset?: (list: T[]) => void) => { let cursor = 0 return () => { if (cursor < list.length) { const result = list[cursor] cursor += 1 return result } if (onNextItemReset) onNextItemReset(list) cursor = 1 return list[0] }...
miguelcjalmeida/vagante-dsmod
src/config/room-loader.ts
<gh_stars>1-10 import * as fs from 'fs' import { IRoomContext } from '../rooms/context' export function loadRoom(path: string) { console.log(`${path} loading`) const content = fs.readFileSync(path, 'utf8') return JSON.parse(content) as IRoomContext } export function saveRoom(path: string, rooms: IRoomContext) {...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission.ts
import { IRoomContext, IRoomBlock, IRoom, IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names' import { findAct } from '../finders/find-act' import { getActValueFromRoomType } from '../item-builder/get-act-value' import { replaceChests } from './merchant-intermission/replace-chests' import { En...
miguelcjalmeida/vagante-dsmod
src/item-builder/equipment-profile.ts
import { AttributeTypes, ItemTypes } from '../rooms/types' import { IItemAttributes } from '../rooms/entities' export interface IEquipmentProfilesIndex { [index: string] : IEquipmentProfile } export type IEquipmentProfiles = IEquipmentProfile[] & IEquipmentProfilesIndex export enum EquipmentType { PrimaryWeapon ...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-handmaid-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' ...
miguelcjalmeida/vagante-dsmod
src/tools/create-unique-lottery-picker.ts
import { ILottery, createLotteryPicker, ILotteryNextOf } from './create-lottery-picker' import { INextOf } from '../manipulators/next-item-factory' import { shuffleArray } from './shuffle-array' export function createUniqueLotteryPicker<T extends Object>(lottery: ILottery<T>) : INextOf<T> { const map = new Map<T, Bo...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-giant-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { improveEquipment } from '../../item-builder/improve-equipment' export function replaceGiantItems(placeholders: IItemEntity[], level: number) { placeholders.forEach((x : IBookEntity) ...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/merchant-profile.ts
import { IItemEntity } from '../../rooms/entities' import { replaceAndreItems } from '../merchant-intermission/replace-andre-items' import { uniqueId } from '../../tools/unique-id' import { ItemTypes, EntityTypes } from '../../rooms/types' import { replaceLenigrastItems } from '../merchant-intermission/replace-lenigras...
miguelcjalmeida/vagante-dsmod
src/manipulators/clone-room-from-template.ts
import { IRoomBlock } from '../rooms/context' import { dsmod } from './get-template' import { findRoom } from './find-room' import { cloneRoom } from './clone-room' export const cloneDsRoomInto = (room1: IRoomBlock, templateRoomUid: string) => { const templateRoom = findRoom(dsmod, templateRoomUid) if (!templateRo...
miguelcjalmeida/vagante-dsmod
src/item-builder/basic-lottery.ts
import { createLotteryPicker } from '../tools/create-lottery-picker' import { basicAttributes } from './attributes-by-type' export const nextBasicAttribute = createLotteryPicker({ common: { proportion: 1, possibilities: basicAttributes, }, })
miguelcjalmeida/vagante-dsmod
src/tools/unique-id.ts
let pool = 0 export const uniqueId = () => { pool += 1 return `Obj_${pool}` }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-shrine.ts
<gh_stars>1-10 import { IRoomBlock } from '../../rooms/context' import { IShrineEntity } from '../../rooms/entities' import { findRoomEntities } from '../../finders/find-room-entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { EntityTypes, ShrineTypes } from '../../rooms/types' im...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-yoel-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' ...
miguelcjalmeida/vagante-dsmod
src/item-builder/improve-equipment-attr.ts
<gh_stars>1-10 import { IItemEntity } from '../rooms/entities' import { AttributeTypes } from '../rooms/types' import { IEquipmentProfile } from './equipment-profile' export function improveEquipAttr( equip: IEquipmentProfile, attrType: AttributeTypes, levelupValue: number, ) { if (!equip.attributes) equip.a...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-sirris-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { IBookEntity, IItemEntity } from '../../rooms/entities' import { AttributeTypes, ItemTypes } from '../../rooms/types' import { improveEquipAttr } from '../../item-builder/improve-equipment-attr' import { improveEquipment } from '../../item-builder/improve-equipment' impor...
miguelcjalmeida/vagante-dsmod
src/rooms/types.ts
<reponame>miguelcjalmeida/vagante-dsmod export enum ChestTypes { Small = 0, Locked = 1, } export enum EntityTypes { Chest = 'Chest', Shop = 'Shop', Item = 'Item', Doodad = 'Doodad', Shrine = 'Shrine', Bonfire = 'Bonfire', Grave = 'Grave', LoadSavePoint = 'LoadSavePoint', Boulder = 'Boulder', Bo...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-greirat-items.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { ItemTypes, EntityTypes, BookTypes } from '../../rooms/types' import { IItemEntity, IBookEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { improveEquipment, IImproveEquipConfig } from '../.....
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-siegward-items.ts
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { priceUp } from '../../item-builder/price-up' const nextFood = createLotteryPicker( { foods: { ...
miguelcjalmeida/vagante-dsmod
src/item-builder/improve-equipment.ts
import { createLotteryPicker, ILottery, ILotteryNextOf } from '../tools/create-lottery-picker' import { IItemEntity, IItemAttributes } from '../rooms/entities' import { nextBasicAttribute } from './basic-lottery' import { IAttributeProfile, attributeProfiles } from './attribute-profile' import { equipmentProfiles, ...
miguelcjalmeida/vagante-dsmod
src/tools/deep-clone.ts
<filename>src/tools/deep-clone.ts const cloneDeep = require('clone-deep') export function deepClone<T>(src: T) { return cloneDeep(src) as T }
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-lenigrast-items.ts
<reponame>miguelcjalmeida/vagante-dsmod import { equipmentProfiles, EquipmentType, EquipmentSubType } from '../../item-builder/equipment-profile' import { ItemTypes, EntityTypes } from '../../rooms/types' import { IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lotter...
miguelcjalmeida/vagante-dsmod
src/manipulators/get-template.ts
<reponame>miguelcjalmeida/vagante-dsmod import { config } from '../config/config' import { loadRoom } from '../config/room-loader' export const dsmod = loadRoom(config.buildroom)
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-replacer/scenes/random-merchant-scene.ts
import { IShopEntity, IEntity } from '../../../rooms/entities' import { createUniqueLotteryPicker } from '../../../tools/create-unique-lottery-picker' import { andreBuilder, lenigrastBuilder, yoelBuilder, siegwardBuilder, patchesBuilder, greiratBuilder, handmaidBuilder, orbeckBuilder, ir...
miguelcjalmeida/vagante-dsmod
src/transformators/fairy-replace.ts
<reponame>miguelcjalmeida/vagante-dsmod<filename>src/transformators/fairy-replace.ts import { IRoomContext } from '../rooms/context' import { findEntities } from '../finders/find-entities' import { EntityTypes } from '../rooms/types' import { IHoverText } from '../rooms/hovertext' export const fairyReplace = (context...
miguelcjalmeida/vagante-dsmod
src/rooms/entities.ts
import { ChestTypes, ItemTypes, DoodadTypes, ShrineTypes, BookTypes, AttributeTypes } from './types' export interface IEntity { type: string x: number y: number champion?: number } export interface IChestEntity extends IEntity { uid?: string chestType: ChestTypes type: 'Chest' links?: string[] } exp...
miguelcjalmeida/vagante-dsmod
src/transformators/transformator.ts
import { IRoomContext } from '../rooms/context' export type ITransformator = (context: IRoomContext) => void
miguelcjalmeida/vagante-dsmod
src/finders/find-act.ts
import { IRoomContext } from '../rooms/context' import { RoomNames } from '../rooms/names' export const findAct = (context: IRoomContext, name: RoomNames) => { for (const act of context.acts) { if (act._comment === name) return act } return null }
miguelcjalmeida/vagante-dsmod
src/transformators/items-creator.ts
import { IRoomContext, IRoomAct } from '../rooms/context' import { findAct } from '../finders/find-act' import { RoomNames } from '../rooms/names' import { EntityTypes, ItemTypes, ChestTypes } from '../rooms/types' import { findEntities } from '../finders/find-entities' import { IChestEntity, IItemEntity } from '../roo...
miguelcjalmeida/vagante-dsmod
src/finders/find-entities.ts
<gh_stars>1-10 import { IRoomAct, IRoomBlock } from '../rooms/context' import { IEntity } from '../rooms/entities' export type findEntitiesMatcher = (entity: IEntity) => boolean export interface IFindEntityResult<T> { nest: IEntity[] entity: T tiles: any[] block: IRoomBlock } export const findEntities = <T ...
miguelcjalmeida/vagante-dsmod
src/manipulators/add-item.ts
import { IEntity, IItemEntity, IChestEntity } from '../rooms/entities' import { EntityTypes, ItemTypes } from '../rooms/types' import { uniqueId } from '../tools/unique-id' import { ITreasureItem } from './add-item-into-treasure' export const addItem = (nest: IEntity[], item: IItemOptions) => { const itemId = un...
miguelcjalmeida/vagante-dsmod
src/item-builder/get-act-value.ts
import { IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names' export function getActValue(act: IRoomAct) { return getActValueByName(act._comment) } export function getActValueFromRoomType(roomType: string) { if (roomType === '0') return getActValueByName(RoomNames.ACT_ONE) if (roomType ...
miguelcjalmeida/vagante-dsmod
src/finders/find-room-entities.ts
<gh_stars>1-10 import { IRoomAct, IRoomBlock } from '../rooms/context' import { IEntity } from '../rooms/entities' import { IFindEntityResult, findEntitiesMatcher } from './find-entities' export const findRoomEntities = <T extends IEntity>( block: IRoomBlock, matcher: findEntitiesMatcher) => { const results = [] ...
miguelcjalmeida/vagante-dsmod
src/item-builder/price-up.ts
<filename>src/item-builder/price-up.ts import { IItemEntity } from '../rooms/entities' import { AttributeTypes } from '../rooms/types' const possibilites = [ AttributeTypes.Str, AttributeTypes.Dex, AttributeTypes.Vit, AttributeTypes.Spd, AttributeTypes.Int, AttributeTypes.Luk, AttributeTypes.Def, Attri...
miguelcjalmeida/vagante-dsmod
src/manipulators/add-simple-entity.ts
import { IEntity } from '../rooms/entities' import { EntityTypes } from '../rooms/types' export const addSimpleEntity = (nest: IEntity[], options: ISimpleEntityOptions) => { nest.push(<IEntity>{ x: options.x, y: options.y, type: options.type, }) } export interface ISimpleEntityOptions { ...
miguelcjalmeida/vagante-dsmod
src/config/config.ts
import * as configJson from '../../config.json' import * as packageJson from '../../package.json' class Config { public buildroom : string public version: string public gameRootDir: string public gameModPath: string private assetsDir: string private distDir: string private projectRootDir: string publi...
miguelcjalmeida/vagante-dsmod
src/modder/apply-mod.ts
<reponame>miguelcjalmeida/vagante-dsmod import { getAllTransformators } from './get-all-transformators' import { config } from '../config/config' import { loadRoom, saveRoom } from '../config/room-loader' export function applyMod() { const rooms = loadRoom(config.asset('rooms.json')) getAllTransformators().forEach...
miguelcjalmeida/vagante-dsmod
src/rooms/names.ts
<gh_stars>1-10 export enum RoomNames { ACT_ONE = 'ACT_ONE', ACT_TWO = 'ACT_TWO', ACT_THREE = 'ACT_THREE', ACT_FOUR = 'ACT_FOUR', BRANCH_ONE = 'BRANCH_ONE', BRANCH_TWO = 'BRANCH_TWO', BRANCH_THREE = 'BRANCH_THREE', BRANCH_FOUR = 'BRANCH_FOUR', Intermission = 'INTERMISSION', Tutorial = 'TUTORIAL', ...
miguelcjalmeida/vagante-dsmod
src/manipulators/add-treasure.ts
import { IEntity, IChestEntity } from '../rooms/entities' import { uniqueId } from '../tools/unique-id' import { EntityTypes, ChestTypes } from '../rooms/types' import { ITreasureItem, addItemIntoTreasure } from './add-item-into-treasure' import { addLabel } from './add-label' export const addTreasure = (nest: IEntity...
miguelcjalmeida/vagante-dsmod
src/manipulators/clone-room.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import { IRoomContext, IRoomBlock } from '../rooms/context' export const cloneRoom = (targetRoom: IRoomBlock, modelRoom: IRoomBlock) => { targetRoom.entities = deepCopy(modelRoom.entities) targetRoom.tiles = modelRoom.tiles } function deepCopy(obj: any) { le...
miguelcjalmeida/vagante-dsmod
src/rooms/hovertext.ts
import { IEntity } from './entities' export interface IHoverText extends IEntity { uid: string w: number h: number text: string animated: boolean animDelay: number } export interface ITriggerCondition extends IEntity { type: TriggerTypes } export enum TriggerTypes { touchingPlayer = 'TOUCHING_PLAYER'...
miguelcjalmeida/vagante-dsmod
src/modder/install-mod.ts
<reponame>miguelcjalmeida/vagante-dsmod<gh_stars>1-10 import * as fs from 'fs' import { applyMod } from './apply-mod' import * as Shell from 'node-powershell' import { config } from '../config/config' export function installMod() { applyMod() const roomsPath = config.dist('rooms.json') const vagantePath = conf...
miguelcjalmeida/vagante-dsmod
src/transformators/label-firekeeper.ts
<gh_stars>1-10 import { IRoomContext, IRoomBlock, IActSpecification, IRoomAct } from '../rooms/context' import { RoomNames } from '../rooms/names'; import { addLabel } from '../manipulators/add-label'; export const labelFirekeepr = (ctx: IRoomContext) => { console.log('labeling firekeepr') ctx.acts.forEach((act)...
miguelcjalmeida/vagante-dsmod
src/item-builder/attribute-profile.ts
import { AttributeTypes as x, AttributeTypes } from '../rooms/types' export interface IAttributeProfilesIndex { [index: string] : IAttributeProfile } export type IAttributeProfiles = IAttributeProfile[] & IAttributeProfilesIndex export enum AttributeRestrictions { Weapon = 0, Bow = 1, AllWeapon = 2, Armor ...
miguelcjalmeida/vagante-dsmod
src/manipulators/add-label.ts
import { IEntity, IChestEntity } from '../rooms/entities' import { uniqueId } from '../tools/unique-id' import { EntityTypes, ChestTypes } from '../rooms/types' import { IHoverText, ITrigger, TriggerTypes } from '../rooms/hovertext' export const addLabel = (nest: IEntity[], label: ILabelOptions) => { const labelId =...
miguelcjalmeida/vagante-dsmod
src/transformators/merchant-intermission/replace-chests.ts
<filename>src/transformators/merchant-intermission/replace-chests.ts<gh_stars>1-10 import { IRoomBlock } from '../../rooms/context' import { IChestEntity, IItemEntity } from '../../rooms/entities' import { findRoomEntities } from '../../finders/find-room-entities' import { EntityTypes } from '../../rooms/types' import ...
tomconte/AzSearchStore
src/reducers/facets.ts
<gh_stars>0 import { FacetsAction, SetFacetRangeAction, ToggleCheckboxFacetAction, AddCheckboxFacetAction, AddRangeFacetAction, SetFacetModeAction, SetFacetsValuesAction, UpdateFacetValuesAction, ClearFacetsSelectionsAction, SetGlobalFilterAction } from "../actions/facetsActions"; import { Store } f...
abkl/csim
src/pages/index.tsx
<reponame>abkl/csim<filename>src/pages/index.tsx import React from "react" import SEO from "../components/seo" import styled from "@emotion/styled" import Image from "../components/image" import { graphql } from "gatsby" const PageHeader = styled.h1` text-align: center; ` const SubText = styled.p` text-align: cente...
abkl/csim
src/components/charts/piechart.tsx
<reponame>abkl/csim<gh_stars>0 import React from "react" import { VictoryPie, VictoryTheme } from "victory" import styled from "@emotion/styled" const OuterDiv = styled.div` max-width: 500px; max-height: 500px; margin: auto; ` export default function PieChart() { return ( <OuterDiv> <VictoryPie ...
abkl/csim
src/components/form-components/checkbox.tsx
import React from "react" // TODO: Store checkbox data in csv and not array const csvToArray = (str: string): string[] => str.split(",") const arrayToCsv = (strA: string[]): string => strA.join(",") export const updateValues = (checkboxValue: string, values: string): string => { const valuesArray = csvToArray(values)...
abkl/csim
src/templates/default-layout.tsx
import React from "react" import RootContext from "../contexts/root-context" import { ThemeProvider } from "emotion-theming" import theme from "../utils/theme" import { StaticQuery, graphql } from "gatsby" import { rhythm } from "../utils/typography" import AppBar from "../components/app-bar" const Layout = ({ childre...
abkl/csim
src/components/form-components/display-values.tsx
<gh_stars>0 import React from "react" import ReactTable from "react-table" import "react-table/react-table.css" const DisplayValues = ({ values }: { values: { [s: string]: string } }) => ( <ReactTable data={Object.keys(values).map(key => ({ property: key, value: values[key], }))} defaultPageSi...
abkl/csim
src/components/form-components/form-template.tsx
import React, { useState } from "react" import { Formik } from "formik" import Button from "../primatives/button" import { initiallizeFormState } from "./form-util" import { css } from "@emotion/core/" import DisplayFields from "./display-fields" import { Fields } from "../../utils/game-constants" import { rhythm } fro...
abkl/csim
src/pages/offline-data.tsx
import React, { useEffect, useState } from "react" import localforage from "localforage" import Button from "../components/primatives/button" import ReactTable from "react-table" import "react-table/react-table.css" import axios from "axios" import Modal from "../components/primatives/modal" const proxyurl = "https://c...
abkl/csim
lib/data-functions.ts
<reponame>abkl/csim import { mean, sampleStandardDeviation } from "simple-statistics" import { fields, gameValues } from "../src/utils/game-constants" // Types: interface TotalStats { totalMeans: { [s: string]: number } totalStdDeviations: { [s: string]: number } } type GameItem = "Cargo" | "Hatch Panel...
abkl/csim
src/components/primatives/link.tsx
<reponame>abkl/csim import { Link } from "gatsby" import styled from "@emotion/styled" const StyledLink = styled(Link)` color: ${props => props.theme.shadow.light}; &:active { color: ${props => props.theme.shadow.dark}; } ` export default StyledLink
abkl/csim
src/components/form-components/slider.tsx
<filename>src/components/form-components/slider.tsx<gh_stars>0 import React from "react" import Slider, { createSliderWithTooltip } from "rc-slider" import theme from "../../utils/theme" import "rc-slider/assets/index.css" interface FormSliderProps { onChange: (v: any) => void name: string value: string min?: n...
abkl/csim
src/utils/randomData.ts
<reponame>abkl/csim<filename>src/utils/randomData.ts export default [ { "Your Name": "Skinner", "Team Number": 0, "Event Code": "sfr", "Match Number": 16, "Robot Starting Platform": "level 1", "Leave Habitat": "FALSE", "Number of Hatch Panels(Sandstorm)": 37, "Number of Cargo(Sandstorm...
abkl/csim
src/components/app-bar.tsx
import { Link } from "gatsby" import { css } from "@emotion/core" import { rhythm } from "../utils/typography" import React from "react" import styled from "@emotion/styled" interface HeaderProps { siteTitle: string } const LinkP = styled.p` display: inline-block; align-self: flex-end; font-style: normal; pad...
abkl/csim
src/pages/scouting-form.tsx
import React from "react" import { css } from "@emotion/core" import Form from "../components/form-components/form-template" import { fields } from "../utils/game-constants" const ScoutingFormPage = () => ( <> <h1 css={css` text-align: center; `} > Scouting Form </h1> <p ...
abkl/csim
src/components/primatives/divs.tsx
import styled from "@emotion/styled" export const FlexAlignCenter = styled.div` display: flex; justify-content: center; align-content: center; flex-direction: column; height: 100%; width: 100%; `
abkl/csim
src/globals.d.ts
<filename>src/globals.d.ts<gh_stars>0 /* eslint-disable import/export */ declare module "tailwind.macro" { export default function tw(a: TemplateStringsArray): string } declare module "react-table/lib/hoc/foldableTable" { import { Column, TableProps } from "react-table" interface FoldableColumn<T> extends Column...
abkl/csim
src/components/form-components/counter.tsx
<reponame>abkl/csim import React from "react" import Button from "../primatives/button" import css from "@emotion/css" import { MdArrowUpward, MdArrowDownward } from "react-icons/md" interface CounterProps { setFieldValue: (field: string, value: any) => void name: string values: { [s: string]: string } dr...
abkl/csim
src/pages/picklist.tsx
import React from "react" const PickListPage = () => { return ( <div> <h1> Your PickList </h1> <em> Not synced to the internet, local only. </em> </div> ) } export default PickListPage
abkl/csim
src/utils/apiRequests.ts
<gh_stars>0 import axios from "axios" export const fetchTeamsFromTBA = async (eventKey: string) => { try { let res = await axios.get( `https://www.thebluealliance.com/api/v3/event/${eventKey}/teams/simple`, { headers: { "X-TBA-Auth-Key": "<KEY>", }, } )...
abkl/csim
lib/transform-fields.ts
<filename>lib/transform-fields.ts<gh_stars>0 import { Fields } from "../src/utils/game-constants" import { fetchTeamsFromTBA } from "./apiFetches" // run using ts-node, use: ` ts-node -O '{"module": "commonjs"}' ./transform-fields.ts ` const fields: Fields = { General: [ "Scouter Name", "Team Number", { ...
abkl/csim
test/form-utils.spec.ts
<gh_stars>0 // import { updateValues } from "../src/components/form-components/checkbox" // describe("util function works", () => { // test("updateValues should work", () => { // expect(updateValues("hello", "world,haha")).toBe("world,haha,hello") // }) // })
abkl/csim
src/templates/all-teams-template.tsx
<reponame>abkl/csim<filename>src/templates/all-teams-template.tsx import React, { useContext } from "react" import { TeamObject } from "./team-template" import Link from "../components/primatives/link" import ReactTable from "react-table" import foldableTable from "react-table/lib/hoc/foldableTable" import "react-table...
abkl/csim
src/utils/theme.ts
export default { primary: { red: "#8A0002", black: "#000", white: "#fff", }, highlight: { light: "#E6E6E6", dark: "#A5A4AA", }, shadow: { light: "#6B0000", dark: "#4D0002", }, }
abkl/csim
src/contexts/root-context.tsx
import React, { createContext, useState } from "react" import { MatchData, Teams } from "../../lib/data-functions" import { data } from "../../lib/randomData" export interface RootState { matchData: MatchData[] | [] teams: Teams | {} pickList: number[] } interface Props { children: React.ReactNode } export cons...
abkl/csim
src/pages/pit-scouting.tsx
import React from "react" import css from "@emotion/css" import Form from "../components/form-components/form-template" import { Fields } from "../utils/game-constants" export const fields: Fields = { General: [ "Scouter Name", "Team Number", { "field-name": "How much experience do your drivers have...
abkl/csim
src/templates/team-template.tsx
<gh_stars>0 import React, { useContext } from "react" import { RootContext, RootState } from "../contexts/root-context" import Button from "../components/primatives/button" import PieChart from "../components/charts/piechart" import ReactTable from "react-table" import { navigate } from "gatsby" /* eslint camelcase: "o...
abkl/csim
src/utils/last-year-data.ts
const data = [ { Timestamp: "10/6/2018 8:48:39", "Team number": "3501", "Match number": "16", "Scout name(your name)": "<NAME>", "Cross baseline during auto?": "No", "Number of cubes dropped off in the switch (during auto)": "0", "Number of cubes dropped off in the scale (during auto)": "0...
abkl/csim
src/components/primatives/button.tsx
import styled from "@emotion/styled" interface ButtonProps { primary: boolean } const Button = styled.button` min-width: 2rem; padding: 6px 16px; box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1), 0 6px 20px 0 rgba(0, 0, 0, 0.09); border: 2px solid ${props => props.theme.primary.red}; border-radius: 4px; outli...
abkl/csim
src/components/form-components/form-util.ts
import * as Yup from "yup" import { Fields } from "../../utils/game-constants" export const initiallizeFormState = (fields: Fields): { [s: string]: any } => Object.keys(fields) .map(f => fields[f]) // map out the fields into [[fields]] .reduce((acc, val) => acc.concat(val), []) // flattens the array .redu...
abkl/csim
src/components/form-components/radio.tsx
import React from "react" import css from "@emotion/css" import { FieldProps } from "formik" const Radio = (props: FieldProps & { options: string[] }) => ( <fieldset css={css` display: inline-flex; position: relative; flex-direction: column; align-items: flex-start; width: 100%; ...
abkl/csim
lib/script.ts
/* eslint-disable @typescript-eslint/no-var-requires */ import { fetchDataFromSheets } from "./apiFetches" import { sheetsDataToJSON, calculateScore, collectMatchDataIntoTeamObj, calculateTotalStats, } from "./data-functions" import { sampleStandardDeviation } from "simple-statistics" import fs from "fs" // ts...
abkl/csim
src/components/form-components/display-fields.tsx
import React from "react" import Counter from "./counter" import { Field } from "formik" import { FieldType } from "../../utils/game-constants" import Radio from "./radio" import Switch from "./switch" import CheckboxGroup from "./checkbox" import css from "@emotion/css" import FormSlider from "./slider" interface Dis...
abkl/csim
src/components/form-components/switch.tsx
import React from "react" import { FieldProps } from "formik" import styled from "@emotion/styled" const GlobalContainer = styled.label` display: flex; justify-content: center; align-items: center; padding-bottom: 5%; ` const InputContainer = styled.label` position: relative; display: inline-block; widt...
abkl/csim
src/utils/game-constants.ts
export const gameValues = { "Hatch Panel": 2, Cargo: 3, "Sandstorm Cross": { "level 1": 3, "level 2": 6, }, "Habitat Return": { "level 1": 3, "level 2": 6, "level 3": 12, }, Defending: 5, "Hab Docking": "1 RP", "Complete Rocket": "1 RP", } export type FieldType = | string | { ...
abkl/csim
test/data-functions.spec.ts
import { sheetsDataToJSON, collectMatchDataIntoTeamObj, getGameItemKeyFromMatchDataKey, calculateScore, ScoresObj, } from "../lib/data-functions" import { mean, standardDeviation } from "simple-statistics" import { fields, gameValues } from "../src/utils/game-constants" const fieldString = Object.keys(fields)...
abkl/csim
src/components/primatives/modal.tsx
<filename>src/components/primatives/modal.tsx<gh_stars>0 import React, { useEffect, useRef, useLayoutEffect } from "react" import styled from "@emotion/styled" const ModalOverlay = styled.div` align-items: center; justify-content: center; background-color: rgba(0, 0, 0, 0.65); display: flex; padding: 1em; ...
abkl/csim
lib/apiFetches.d.ts
<filename>lib/apiFetches.d.ts import { TeamObject } from "../src/templates/team-template" export function fetchTeamsFromTBA( eventKey: string, event: string ): Promise<TeamObject[]> export function fetchDataFromSheets(): Promise<any[][]>
abkl/csim
src/utils/typography.ts
<reponame>abkl/csim<filename>src/utils/typography.ts<gh_stars>0 import Typography, { TypographyOptions } from "typography" // @ts-ignore import oceanBeachTheme from "typography-theme-ocean-beach" ;(oceanBeachTheme as TypographyOptions).overrideThemeStyles = () => ({ "h1,h2,h3,h4,h5": { marginTop: 0, }, }) const...
srdejo/-adn-ceiba-front-comercio
src/app/feature/comercio/comercio.module.ts
<filename>src/app/feature/comercio/comercio.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ComercioRoutingModule } from './comercio-routing.module'; import { ComercioComponent } from './components/comercio/comercio.component'; import { CrearComercioComponen...
srdejo/-adn-ceiba-front-comercio
src/app/app.component.ts
import { Component } from '@angular/core'; import { MenuItem } from '@core/modelo/menu-item'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'app-base'; public menuItems: MenuItem[] = [ { url: '/home', no...
srdejo/-adn-ceiba-front-comercio
src/app/shared/service/comercio.service.ts
import { Injectable } from '@angular/core'; import { HttpService } from '@core/services/http.service'; import { Comercio } from '@shared/modelo/comercio'; import { CookieService } from 'ngx-cookie-service'; import { throwError } from 'rxjs'; import { environment } from 'src/environments/environment'; @Injectable() exp...
srdejo/-adn-ceiba-front-comercio
src/app/shared/components/toast/toast.component.ts
import { Component, TemplateRef } from '@angular/core'; import { ToastService } from '@shared/service/toast.service'; @Component({ selector: 'app-toast', templateUrl: './toast.component.html', styleUrls: ['./toast.component.scss'] }) export class ToastComponent { constructor(public toastService: ToastService)...