Code Monkey home page Code Monkey logo

brackets-toornament-layer's Introduction

brackets-toornament-layer

A layer to convert Toornament data to brackets-viewer.js data.

You can use this to view Toornament stages with your own personalized viewer without embedding Toornament's viewer.

npm

Input

You need to give data for one tournament at a time.

Toornament API routes needed:

  • /stages to have the list of stages
  • /bracket-nodes to have the source_node_id property (used to have the position property)
  • /matches/{match_id}/games for each match (if you know you have child matches, i.e. Bo3, Bo5, ...)

The input is constructed as this:

{
    "tournament_id": "4468708049713692672", // Input tournament ID
    "stages": [ 
        // Output of `/stages?tournament_ids=4468708049713692672`
    ],
    "matches": [ 
        // Output of `/matches?stage_ids=618965765764577354,618931468547654563` for round-robin stages 
        // and `/bracket-nodes?tournament_ids=4468708049713692672` for single and double elimination brackets
    ],
    "match_games": [ 
        // Flattened list of all `/matches/{match_id}/games` list results
    ]
}

Note: If match_games is omitted, the child_count will be set to 0.

How to test

First, do npm start. This will generate the database file db.json.

To quickly test the results, you can use json-server.

npx json-server ./output/db.json

Then, open the ./demo/index.html file from the brackets-viewer.js project.

And tada! You are viewing Toornament data with your own viewer! ๐ŸŽ‰

Credits

This library has been created to be used by the Nantarena.

brackets-toornament-layer's People

Contributors

drarig29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

brackets-toornament-layer's Issues

Support match games

Currently, match games are ignored because the viewer does not show them.

[Question] Static HTML - jsDilvr Supported ?

Can the package work inside static HTML files. For example: https://cdn.jsdelivr.net/npm/brackets-viewer/dist/brackets-viewer.min.js

If so, can you please show an example of the usage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.