1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 10:52:10 +00:00

feat: Add Github Table as SVG (#232)

This commit is contained in:
Florian Bouillon 2022-01-19 11:29:27 +01:00 committed by GitHub
parent fbde4a9b5f
commit 97a521ddac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 11 deletions

View File

@ -53,16 +53,11 @@ There is three sub folders that will allow you to edit some faces of the databas
- `/meta`: Contains informations for the project (definitions files, Translations for some fields)
- `/server`: The server that allow to communicate with the database
## Translations
## Status
We have a big effort on translating datas for older sets
We are making sure to make every cards available for every languages they were available !
_note: numbers updated manually_
| | English | French | German | Italian | Portuguese | Spanish |
|-------------|---------|--------|--------|---------|------------|---------|
| Cards | 14419 | 9846 | 6590 | 6576 | 6593 | 6590 |
| Translated | 100% | 68.2% | 45.7% | 45.6% | 45.7% | 45.7% |
![TCGdex Progress](https://api.tcgdex.net/status/github.svg)
_want to help translating? each object fields on cards that have at least en,fr,es,de,it or pt can have the others!,_
_Also we have another translation files located at `meta/translations`_

View File

@ -64,6 +64,7 @@ type Card {
category: String!
description: String
dexId: [Float]
effect: String
energyType: String
evolveFrom: String
hp: Float
@ -86,6 +87,8 @@ type Card {
types: [String]
variants: Variants
weaknesses: [WeakResListItem]
# Currently not in any cards
# weight: String!
}
type AbilitiesListItem {
@ -137,6 +140,7 @@ type Set {
symbol: String
serie: Serie!
releaseDate: String!
tcgOnline: String
}
type CardCount {

View File

@ -2,4 +2,44 @@
The server running the TCGdex API.
More informations at https://github.com/tcgdex/cards-database#pokemon-tcgdex
## Installing/Running
### Using NodeJS/NPM
You will need NPM/NodeJS installed
1. Install deps for both this directory and the parent directory
```
npm install
cd ..
npm install
cd server
```
2. Compile the database
```
cd ..
npm run compile
cd server
npm run compile
```
3. run the server !
Dev mode
```
npm run dev
```
Production mode
```
npm run build
npm run start
```
### Using Docker
Go to the parent directory and build the Dockerfile!

View File

@ -54,8 +54,48 @@ preProcessSets(itStats, 'it')
preProcessSets(ptStats, 'pt')
preProcessSets(deStats, 'de')
export default express.Router().get('/', (_, res): void => {
// Yes this is ugly
export default express.Router()
.get('/github.svg', (_, res): void => {
res.setHeader('Content-Type', 'image/svg+xml')
res.send(`<svg width="1052" height="239" viewBox="0 0 1052 239" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="1052" height="239" rx="16" fill="white"/>
<rect width="1052" height="50" rx="16" fill="#F4F4F4"/>
<text fill="#999999" font-weight="bold" ><tspan x="145.5" y="30.944">English</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="275" y="30.944">French</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="404.5" y="30.944">German</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="534" y="30.944">Italian</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="663.5" y="30.944">Portuguese</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="793" y="30.944">Spanish</tspan></text>
<text fill="#999999" font-weight="bold" ><tspan x="922.5" y="30.944">Total</tspan></text>
<text fill="black"><tspan x="16" y="91.444">Card Progress</tspan></text>
<text fill="black"><tspan x="145.5" y="80.944">${enStats.count} of ${enStats.total}&#10;</tspan><tspan x="145.5" y="101.944">${(100 * enStats.count / enStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="275" y="80.944">${frStats.count} of ${frStats.total}&#10;</tspan><tspan x="275" y="101.944">${(100 * frStats.count / frStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="404.5" y="80.944">${deStats.count} of ${deStats.total}&#10;</tspan><tspan x="404.5" y="101.944">${(100 * deStats.count / deStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="534" y="80.944">${itStats.count} of ${itStats.total}&#10;</tspan><tspan x="534" y="101.944">${(100 * itStats.count / itStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="663.5" y="80.944">${ptStats.count} of ${ptStats.total}&#10;</tspan><tspan x="663.5" y="101.944">${(100 * ptStats.count / ptStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="793" y="80.944">${esStats.count} of ${esStats.total}&#10;</tspan><tspan x="793" y="101.944">${(100 * esStats.count / esStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="922.5" y="80.944">${totalStats.count} of ${totalStats.total}&#10;</tspan><tspan x="922.5" y="101.944">${(100 * totalStats.count / totalStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="16" y="151.944">Images </tspan><tspan x="16" y="169.944">Progress</tspan></text>
<text fill="black"><tspan x="145.5" y="150.444">${enStats.images} of ${enStats.total}&#10;</tspan><tspan x="145.5" y="171.444">${(100 * enStats.images / enStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="275" y="150.444">${frStats.images} of ${frStats.total}&#10;</tspan><tspan x="275" y="171.444">${(100 * frStats.images / frStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="404.5" y="150.444">${deStats.images} of ${deStats.total}&#10;</tspan><tspan x="404.5" y="171.444">${(100 * deStats.images / deStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="534" y="150.444">${itStats.images} of ${itStats.total}&#10;</tspan><tspan x="534" y="171.444">${(100 * itStats.images / itStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="663.5" y="150.444">${ptStats.images} of ${ptStats.total}&#10;</tspan><tspan x="663.5" y="171.444">${(100 * ptStats.images / ptStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="793" y="150.444">${esStats.images} of ${esStats.total}&#10;</tspan><tspan x="793" y="171.444">${(100 * esStats.images / esStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="922.5" y="150.444">${totalStats.images} of ${totalStats.total}&#10;</tspan><tspan x="922.5" y="171.444">${(100 * totalStats.images / totalStats.total).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="16" y="219.944">Total Progress</tspan></text>
<text fill="black"><tspan x="145.5" y="209.444">${enStats.images + enStats.count} of ${enStats.total * 2}&#10;</tspan><tspan x="145.5" y="230.444">${(100 * (enStats.images + enStats.count) / (enStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="275" y="209.444">${frStats.images + frStats.count} of ${frStats.total * 2}&#10;</tspan><tspan x="275" y="230.444">${(100 * (frStats.images + frStats.count) / (frStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="404.5" y="209.444">${deStats.images + deStats.count} of ${deStats.total * 2}&#10;</tspan><tspan x="404.5" y="230.444">${(100 * (deStats.images + deStats.count) / (deStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="534" y="209.444">${itStats.images + itStats.count} of ${itStats.total * 2}&#10;</tspan><tspan x="534" y="230.444">${(100 * (itStats.images + itStats.count) / (itStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="663.5" y="209.444">${ptStats.images + ptStats.count} of ${ptStats.total * 2}&#10;</tspan><tspan x="663.5" y="230.444">${(100 * (ptStats.images + ptStats.count) / (ptStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="793" y="209.444">${esStats.images + esStats.count} of ${esStats.total * 2}&#10;</tspan><tspan x="793" y="230.444">${(100 * (esStats.images + esStats.count) / (esStats.total * 2)).toFixed(2)}%</tspan></text>
<text fill="black"><tspan x="922.5" y="209.444">${totalStats.images + totalStats.count} of ${totalStats.total * 2}&#10;</tspan><tspan x="922.5" y="230.444">${(100 * (totalStats.images + totalStats.count) / (totalStats.total * 2)).toFixed(2)}%</tspan></text>
</svg>
`)
})
.get('/', (_, res): void => {
res.send(`
<style>