Skip to content

Commit

Permalink
init: Repo for Codecharacter Frontend 2024 (squash)
Browse files Browse the repository at this point in the history
fix: Battletv , score

feat: changed homePage mapImage

Fix : offsets and battletv

fix: leaderboard

Fix : assets

fix: scrollbar in battle

refactor:websocket for lsp

fix:remove unwanted logging

fix: tower healthbar

init: Repo for Codecharacter Frontend 2024 (#1)
  • Loading branch information
bhoopesh369 authored and ZaBarudo committed Dec 24, 2023
1 parent 8c44824 commit ca1a95c
Show file tree
Hide file tree
Showing 63 changed files with 241 additions and 229 deletions.
40 changes: 31 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
<h1 align="center">CodeCharacter Web 2023</h1>
<p align="center">Monorepo for the web app, renderer and map designer of CodeCharacter 2023</p>
<h1 align="center">CodeCharacter Web 2024</h1>
<p align="center">Monorepo for the web app, renderer and map designer of CodeCharacter 2024</p>

<p align="center">
<a href="https://github.com/delta/codecharacter-web-2023/actions/workflows/ci.yml">
<img src="https://github.com/delta/codecharacter-web-2023/actions/workflows/ci.yml/badge.svg"/>
<a href="https://github.com/delta/codecharacter-frontend/actions/workflows/ci.yml">
<img src="https://github.com/delta/codecharacter-frontend/actions/workflows/ci.yml/badge.svg"/>
</a>
<a href="https://github.com/delta/codecharacter-web-2023/actions/workflows/docs.yml">
<img src="https://github.com/delta/codecharacter-web-2023/actions/workflows/docs.yml/badge.svg"/>
<a href="https://github.com/delta/codecharacter-frontend/actions/workflows/docs.yml">
<img src="https://github.com/delta/codecharacter-frontend/actions/workflows/docs.yml/badge.svg"/>
</a>
<a href="https://codecov.io/gh/delta/codecharacter-web-2023">
<img src="https://codecov.io/gh/delta/codecharacter-web-2023/branch/main/graph/badge.svg?token=T4A45WWCWM"/>
<a href="https://codecov.io/gh/delta/codecharacter-frontend">
<img src="https://codecov.io/gh/delta/codecharacter-frontend/branch/main/graph/badge.svg?token=T4A45WWCWM"/>
</a>
<br>
<img src=https://img.shields.io/github/deployments/delta/codecharacter-web-2023/Production?label=vercel&logo=vercel">
<img src=https://img.shields.io/github/deployments/delta/codecharacter-frontend/Production?label=vercel&logo=vercel">
</p>

## Setup

1. Configurations

```
cp config/config.example.ts config/config.ts
```

3. Default codes

```
git submodule update --init
```

## Scripts

(To be run with `yarn` prefix)
Expand All @@ -27,6 +41,14 @@
- `lint` runs the linter for the project
- `format` runs the formatter for the project

## Docker

```
docker compose up
```

Container will be running on port **3000**

## Documentation and preview deployments

Check out [here](https://delta.github.io/codecharacter-web-2023/).
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: '3.9'

services:
web:
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CodeCharacter Web 2023
# CodeCharacter Web 2024

### Code Generation Process

Expand Down
2 changes: 1 addition & 1 deletion docs/spec/generator-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ typescriptThreePlus: true
useSingleRequestParameter: false
withInterfaces: true
withoutRuntimeChecks: true
npmName: '@codecharacter-2023/client'
npmName: '@codecharacter-2024/client'
npmVersion: '2023.0.0'
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codecharacter-2023/web",
"description": "The web frontend of CodeCharacter 2023",
"name": "@codecharacter-2024/web",
"description": "The web frontend of CodeCharacter 2024",
"license": "MIT",
"author": "Delta Force",
"version": "2023.0.0",
Expand All @@ -10,21 +10,21 @@
"scripts": {
"lint": "eslint --ext .ts,.tsx . --ignore-path .gitignore && prettier \"**/*.{ts,tsx,js,json,yml,md}\" --check --ignore-path .gitignore",
"format": "eslint --ext .ts,.tsx . --fix --ignore-path .gitignore && prettier \"**/*.{ts,tsx,js,json,yml,md}\" --write --ignore-path .gitignore",
"compile": "yarn workspace @codecharacter-2023/client run tsc && yarn workspace @codecharacter-2023/renderer run tsc && yarn workspace @codecharacter-2023/map-designer run tsc && tsc",
"compile": "yarn workspace @codecharacter-2024/client run tsc && yarn workspace @codecharacter-2024/renderer run tsc && yarn workspace @codecharacter-2024/map-designer run tsc && tsc",
"test": "jest --coverage",
"dev": "concurrently -k -r \"yarn workspace @codecharacter-2023/client build:watch\" \"yarn workspace @codecharacter-2023/renderer build:watch\" \"yarn workspace @codecharacter-2023/map-designer build:watch\" \"sleep 10 && vite --config vite.dev.config.ts\"",
"build": "yarn workspace @codecharacter-2023/client run build && yarn workspace @codecharacter-2023/renderer run build && yarn workspace @codecharacter-2023/map-designer run build && vite build --config vite.prod.config.ts --emptyOutDir",
"prod": "concurrently -k -r \"sleep 5 && vite build --watch --config vite.prod.config.ts --emptyOutDir\" \"sleep 10 && live-server --host=0.0.0.0 --middleware=spa-ignore-assets dist/\" \"yarn workspace @codecharacter-2023/client build:watch\" \"yarn workspace @codecharacter-2023/renderer build:watch\" \"yarn workspace @codecharacter-2023/map-designer build:watch\"",
"renderer:demo": "yarn workspace @codecharacter-2023/renderer run dev",
"map-designer:demo": "yarn workspace @codecharacter-2023/map-designer run dev",
"dev": "concurrently -k -r \"yarn workspace @codecharacter-2024/client build:watch\" \"yarn workspace @codecharacter-2024/renderer build:watch\" \"yarn workspace @codecharacter-2024/map-designer build:watch\" \"sleep 10 && vite --config vite.dev.config.ts\"",
"build": "yarn workspace @codecharacter-2024/client run build && yarn workspace @codecharacter-2024/renderer run build && yarn workspace @codecharacter-2024/map-designer run build && vite build --config vite.prod.config.ts --emptyOutDir",
"prod": "concurrently -k -r \"sleep 5 && vite build --watch --config vite.prod.config.ts --emptyOutDir\" \"sleep 10 && live-server --host=0.0.0.0 --middleware=spa-ignore-assets dist/\" \"yarn workspace @codecharacter-2024/client build:watch\" \"yarn workspace @codecharacter-2024/renderer build:watch\" \"yarn workspace @codecharacter-2024/map-designer build:watch\"",
"renderer:demo": "yarn workspace @codecharacter-2024/renderer run dev",
"map-designer:demo": "yarn workspace @codecharacter-2024/map-designer run dev",
"storybook": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"postinstall": "husky install"
},
"dependencies": {
"@codecharacter-2023/client": "workspace:packages/client",
"@codecharacter-2023/map-designer": "workspace:packages/map-designer",
"@codecharacter-2023/renderer": "workspace:packages/renderer",
"@codecharacter-2024/client": "workspace:packages/client",
"@codecharacter-2024/map-designer": "workspace:packages/map-designer",
"@codecharacter-2024/renderer": "workspace:packages/renderer",
"@custom-elements-manifest/analyzer": "^0.6.6",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@codecharacter-2023/client",
"name": "@codecharacter-2024/client",
"version": "2023.0.0",
"description": "OpenAPI client for CodeCharacter 2023",
"description": "OpenAPI client for CodeCharacter 2024",
"author": "Delta Force",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/map-designer/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@codecharacter-2023/map-designer",
"description": "Webcomponent for CodeCharacter Map Designer 2023",
"name": "@codecharacter-2024/map-designer",
"description": "Webcomponent for CodeCharacter Map Designer 2024",
"license": "MIT",
"author": "Delta Force",
"version": "2023.0.0",
"main": "./dist/codecharacter-map-designer-2023.es.js",
"module": "./dist/codecharacter-map-designer-2023.es.js",
"main": "./dist/codecharacter-map-designer-2024.es.js",
"module": "./dist/codecharacter-map-designer-2024.es.js",
"types": "./dist/src/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/codecharacter-map-designer-2023.es.js"
"import": "./dist/codecharacter-map-designer-2024.es.js"
}
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/map-designer/src/Parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export class Parameters {

static mapTileHalfHeight = 200;

static mapTileOffsetX = 200;
static mapTileOffsetX = 250;

static mapTileOffsetY = 256;
static mapTileOffsetY = 260;

static totalCoins = 6000;

Expand Down
4 changes: 2 additions & 2 deletions packages/map-designer/vite.dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export default defineConfig({
},
build: {
lib: {
name: 'codecharacter-map-designer-2023',
name: 'codecharacter-map-designer-2024',
entry: path.resolve(__dirname, 'src/index.ts'),
fileName: 'codecharacter-map-designer-2023',
fileName: 'codecharacter-map-designer-2024',
},
rollupOptions: {
external: ['phaser', 'lit'],
Expand Down
4 changes: 2 additions & 2 deletions packages/map-designer/vite.prod.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default defineConfig({
build: {
lib: {
formats: ['es'],
name: 'codecharacter-map-designer-2023',
name: 'codecharacter-map-designer-2024',
entry: path.resolve(__dirname, 'src/index.ts'),
fileName: 'codecharacter-map-designer-2023',
fileName: 'codecharacter-map-designer-2024',
},
rollupOptions: {
external: ['phaser', 'lit', 'react'],
Expand Down
10 changes: 5 additions & 5 deletions packages/renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@codecharacter-2023/renderer",
"description": "Webcomponent for CodeCharacter Renderer 2023",
"name": "@codecharacter-2024/renderer",
"description": "Webcomponent for CodeCharacter Renderer 2024",
"license": "MIT",
"author": "Delta Force",
"version": "2023.0.0",
"main": "./dist/codecharacter-renderer-2023.es.js",
"module": "./dist/codecharacter-renderer-2023.es.js",
"main": "./dist/codecharacter-renderer-2024.es.js",
"module": "./dist/codecharacter-renderer-2024.es.js",
"types": "./dist/src/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/codecharacter-renderer-2023.es.js"
"import": "./dist/codecharacter-renderer-2024.es.js"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/scenes/TileMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class TileMap extends Phaser.Scene {
onComplete: () => bombSprite.destroy(),
});
}
tower.healthBar.setHp(newTowerHp);
tower.setHp(newTowerHp);
troop.attack(tower.x, tower.y);
},
);
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/vite.dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export default defineConfig({
},
build: {
lib: {
name: 'codecharacter-renderer-2023',
name: 'codecharacter-renderer-2024',
entry: path.resolve(__dirname, 'src/index.ts'),
fileName: 'codecharacter-renderer-2023',
fileName: 'codecharacter-renderer-2024',
},
rollupOptions: {
external: ['phaser', 'lit', 'react'],
Expand Down
4 changes: 2 additions & 2 deletions packages/renderer/vite.prod.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default defineConfig({
build: {
lib: {
formats: ['es'],
name: 'codecharacter-renderer-2023',
name: 'codecharacter-renderer-2024',
entry: path.resolve(__dirname, 'src/index.ts'),
fileName: 'codecharacter-renderer-2023',
fileName: 'codecharacter-renderer-2024',
},
rollupOptions: {
external: ['phaser', 'lit', 'react'],
Expand Down
Binary file modified public/assets/tower1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/tower2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/tower3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/api/ApiConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthApi, Configuration } from '@codecharacter-2023/client';
import { AuthApi, Configuration } from '@codecharacter-2024/client';
import { BASE_PATH, PREFER_DEV_OVERRIDE, homeUrl } from '../config/config';
export class ApiError extends Error {
status: number;
Expand Down
Binary file added src/assets/deltaMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';
import styles from './forgetpassword.module.css';
import { AuthApi } from '@codecharacter-2023/client';
import { AuthApi } from '@codecharacter-2024/client';
import { ApiError, authConfig } from '../../../../../api/ApiConfig';
import { toast } from 'react-hot-toast';
import { Modal } from 'react-bootstrap';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import styles from '../../auth.module.css';
import { ApiError, authConfig } from '../../../../../api/ApiConfig';
import { AuthApi } from '@codecharacter-2023/client';
import { AuthApi } from '@codecharacter-2024/client';
import { useNavigate, useLocation } from 'react-router-dom';
import Toast, { toast } from 'react-hot-toast';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
import styles from '../../../Auth/Login/IncompleteProfile/incompleteProfile.module.css';
import OtherDetails from '../../Register/FormDetails/OtherDetails';
import { useState } from 'react';
import { CurrentUserApi } from '@codecharacter-2023/client';
import { CurrentUserApi } from '@codecharacter-2024/client';
import { apiConfig, ApiError } from '../../../../../api/ApiConfig';
import { useNavigate } from 'react-router-dom';
import { useAppDispatch } from '../../../../../store/hooks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserApi } from '@codecharacter-2023/client';
import { UserApi } from '@codecharacter-2024/client';
import { Card } from 'react-bootstrap';
import { useLocation, useNavigate } from 'react-router-dom';
import { useState, useEffect } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/components/BattleTV/BattleTV.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}

.automatch {
background-color: antiquewhite;
background-color: rgba(92, 129, 136, 0.37) !important;
}

.item .picholder {
Expand Down
19 changes: 13 additions & 6 deletions src/components/BattleTV/BattleTV.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Match,
MatchMode,
Verdict,
} from '@codecharacter-2023/client';
} from '@codecharacter-2024/client';
import { User, user } from '../../store/User/UserSlice';
import {
changePageState,
Expand All @@ -32,6 +32,10 @@ function getIcon(loggedInUser: User, match: Match) {
return styles.battlecardwin;
} else if (match.matchVerdict == Verdict.Player2) {
return styles.battlecardlose;
} else if (match.matchVerdict == Verdict.Success) {
return styles.battlecardwin;
} else if (match.matchVerdict == Verdict.Failure) {
return styles.battlecardlose;
}
} else {
// user is PLAYER2
Expand Down Expand Up @@ -110,12 +114,15 @@ function PaginatedItems() {
) : (
currentItems &&
currentItems.map((match: Match) => (
<div
className={styles.item + getMatchMode(match)}
key={match.id}
>
<div className={styles.item} key={match.id}>
<div
className={styles.item + ' ' + getIcon(loggedInUser, match)}
className={
styles.item +
' ' +
getIcon(loggedInUser, match) +
' ' +
getMatchMode(match)
}
>
<span className={styles.username}>
<div className={styles.picholder}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommitHistory/CodeMapViewbox/CodeView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeRevision } from '@codecharacter-2023/client';
import { CodeRevision } from '@codecharacter-2024/client';
import { CodeBlock, irBlack } from 'react-code-blocks';
type PropsType = {
code: CodeRevision['code'];
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommitHistory/CodeMapViewbox/MapView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
MapDesignerComponent,
MapDesignerUtils,
} from '@codecharacter-2023/map-designer';
} from '@codecharacter-2024/map-designer';

interface MapViewBoxProps {
mapCoordinates: Array<Array<number>>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommitHistory/CommitTree/CommitHistroy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeRevision, GameMapRevision } from '@codecharacter-2023/client';
import { CodeRevision, GameMapRevision } from '@codecharacter-2024/client';
import { useState } from 'react';
import {
VerticalTimeline,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommitHistory/HistoryMain/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
CurrentUserApi,
GameMapRevision,
MapApi,
} from '@codecharacter-2023/client';
} from '@codecharacter-2024/client';
import {
MapObj,
changeHistoryEditorMap,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommitModal/CommitModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeApi, Language } from '@codecharacter-2023/client';
import { CodeApi, Language } from '@codecharacter-2024/client';
import React, { useState } from 'react';
import { Button, Form, Modal, Row } from 'react-bootstrap';
import { apiConfig, ApiError } from '../../api/ApiConfig';
Expand Down
2 changes: 1 addition & 1 deletion src/components/DashboardOptions/DashboardOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './DashboardOptions.module.css';
import DropdownToggle from 'react-bootstrap/esm/DropdownToggle';
import { ButtonGroup } from 'react-bootstrap';
import { apiConfig, ApiError } from '../../api/ApiConfig';
import { CurrentUserApi } from '@codecharacter-2023/client';
import { CurrentUserApi } from '@codecharacter-2024/client';
import Toast from 'react-hot-toast';
import { useAppDispatch } from '../../store/hooks';
import {
Expand Down
Loading

0 comments on commit ca1a95c

Please sign in to comment.