Skip to content

Commit

Permalink
Edit admin form
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmon committed Mar 24, 2023
1 parent 317242c commit 691f255
Show file tree
Hide file tree
Showing 25 changed files with 985 additions and 215 deletions.
57 changes: 57 additions & 0 deletions Commands/pushDefaultValue.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const { BaseCommand } = require('kurami');
const { getFirestore, collection, addDoc } = require('firebase/firestore');
const chartData = require('./../charts.json');
const scoreData = require('../scores.cjs');
const { initializeApp } = require("firebase/app");

class pushDefaultValue extends BaseCommand {
constructor() {
super({
name: 'load:default:data',
description: 'Push some default charts and scores',
});
}

async run() {
const app = initializeApp({
// firebase config here
});

console.log('Pushing default data...')
console.log('Pushing default charts...')
await this.pushDefaultCharts();
console.log('Pushing default scores...')
await this.pushDefaultScores();
console.log('Done!')
}

async pushDefaultCharts() {
// push chartData content to firestore
const db = getFirestore();
const chartsRef = collection(db, 'Chart');
for (let i = 0; i < chartData.length; i++) {
const chart = chartData[i];
await addDoc(chartsRef, chart).then((docRef) => {
console.log("Document written with ID: ", docRef.id);
}).catch((error) => {
console.error("Error adding document: ", error);
});
}
}

async pushDefaultScores() {
// push scoreData content to firestore
const db = getFirestore();
const scoresRef = collection(db, 'Score');
for (let i = 0; i < scoreData.length; i++) {
const score = scoreData[i];
await addDoc(scoresRef, score).then((docRef) => {
console.log("Document written with ID: ", docRef.id);
}).catch((error) => {
console.error("Error adding document: ", error);
});
}
}
}

module.exports = pushDefaultValue;
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
<!-- Add the image locate in src/assets/test.png -->
<img src="./src/assets/maimai.png" alt="MaiScore" width="15%">

# MaiScore - A Maimai Score viewer
Welcome to MaiScore Project!

## What is MaiScore?
MaiScore is a Maimai Score tracker. It can track your score and show you the score history.
You can look score form precise chart and precise difficulty.
All work manually, you need to post your score in the form linked to each chart. If some chart is missing, a feature to request a new chart is coming soon.

## Set up local server
1. Install Node.js
2. Clone this repository
3. Run `npm install` in the repository
4. Configure your firebase information in 'src/config.js' and in 'Command/pushDeaultValue.cjs'
5. Use Kurami for run the command to push default value in firebase using 'npm run kurami load:default:data'
6. Run `npm run dev` to start local server

## TODO
- Add a feature to request a new chart
- Edit admin part for beter design when adding new chart

## Libraries
- [React](https://reactjs.org/)
- [Vite](https://vitejs.dev/)
- [Firebase](https://firebase.google.com/)
- [Tailwind CSS](https://tailwindcss.com/)
- [React Router](https://reactrouter.com/)
- [Kurami](https://github.com/nesmon/Kurami)

## Disclaimer
This project is not affiliated with Sega or any of its subsidiaries.
The name "Maimai" and the logo are trademarks of Sega.

TODO : Write the readme
12 changes: 8 additions & 4 deletions src/charts.json → charts.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[
{
"id": "axe611acu8",
"name" : "Axeria",
"artist": "AcuticNotes",
"category": "Original",
"category": "original",
"difficulty" : [
{
"Easy": "4",
Expand All @@ -15,9 +16,10 @@
"imageCover": "https://silentblue.remywiki.com/images/d/d8/Axeria.png"
},
{
"id": "our1110t+p8",
"name" : "Our Wrenaly",
"artist": "t+pazolite",
"category": "Original",
"category": "original",
"difficulty" : [
{
"Easy": "4",
Expand All @@ -30,9 +32,10 @@
"imageCover": "https://silentblue.remywiki.com/images/0/05/Our_Wrenally.png"
},
{
"id": "mil57mil4",
"name" : "Milk",
"artist": "モリモリあつし",
"category": "GAME & VARIETY",
"category": "game",
"difficulty" : [
{
"Easy": "1",
Expand All @@ -45,9 +48,10 @@
"imageCover": "https://silentblue.remywiki.com/images/e/eb/MilK.png"
},
{
"id": "pandora_paradoxxx",
"name" : "Pandora Paradoxxx",
"artist": "Sakuzyo",
"category": "Original",
"category": "original",
"difficulty" : [
{
"Easy": "6",
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/png" href="/maimai.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Maimai-Score</title>
<title>MaiScore</title>
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 3 additions & 0 deletions kurami.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"commandsPath": "./Commands"
}
Loading

0 comments on commit 691f255

Please sign in to comment.