Skip to content

Commit

Permalink
WIP: Separate app into workspaces
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Loher <[email protected]>
  • Loading branch information
ghost91- committed Jun 30, 2024
1 parent 4e0ceff commit 150eab8
Show file tree
Hide file tree
Showing 154 changed files with 16,916 additions and 26,698 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
/build-server
build
dist
*.tsbuildinfo

# misc
.DS_Store
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

1 change: 1 addition & 0 deletions apps/client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
93 changes: 93 additions & 0 deletions apps/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "@eop/client",
"type": "module",
"version": "0.23.0",
"main": "src/client/index.tsx",
"scripts": {
"build": "react-scripts build",
"start": "react-scripts start",
"test": "react-scripts test",
"lint": "npm run eslint",
"fixlint": "npm run eslint -- --fix",
"eslint": "eslint --ext .js,.jsx,.ts,.tsx,.cjs .",
"format": "npm run prettier -- --write",
"checkformat": "npm run prettier -- --check",
"prettier": "prettier ."
},
"dependencies": {
"@eop/cornucopia-cards": "*",
"@eop/shared": "*",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.2.0",
"bootstrap": "^4.6.0",
"jointjs": "^3.7.7",
"lodash": "^4.17.21",
"react": "^17.0.2",
"react-countdown-circle-timer": "^3.2.1",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-map-interaction": "^2.1.0",
"react-nl2br": "^1.0.4",
"react-router-dom": "^5.3.1",
"reactstrap": "^8.10.1",
"reactstrap-confirm": "^1.3.2"
},
"devDependencies": {
"@eop/prettier-config": "*",
"@eop/typescript-config": "*",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.5.2",
"@types/backbone": "^1.4.19",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@types/react-helmet": "^6.1.11",
"@types/react-router-dom": "^5.3.3",
"nock": "^13.3.8",
"prettier": "^3.3.2",
"react-scripts": "^5.0.1",
"typescript": "^4.8.4"
},
"overrides": {
"autoprefixer": "10.4.5"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!<rootDir>/node_modules/",
"!src/serviceWorker.js",
"!src/components/board/board.ignoretest.js",
"!src/jointjs/shapes.js",
"!src/index.tsx"
],
"coverageThreshold": {
"global": {
"branches": 5,
"functions": 5,
"lines": 5,
"statements": 5
}
},
"coverageReporters": [
"text",
"lcov"
]
},
"private": true
}
3 changes: 3 additions & 0 deletions apps/client/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from '@eop/prettier-config';

export default config;
File renamed without changes.
2 changes: 1 addition & 1 deletion public/index.html → apps/client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React from 'react';
import {
API_PORT,
DEFAULT_GAME_MODE,
DEFAULT_TURN_DURATION,
ModelType,
} from '@eop/shared';
import { render, screen } from '@testing-library/react';
import Board from './board';
import { DEFAULT_TURN_DURATION, ModelType } from '../../../utils/constants';
import { DEFAULT_GAME_MODE } from '../../../utils/GameMode';
import type { GameState } from '../../../game/gameState';
import type { Ctx } from 'boardgame.io';
import React from 'react';
import nock from 'nock';

import { API_PORT } from '../../../utils/serverConfig';
import Board from './board';

import type { GameState } from '@eop/shared';
import type { Ctx } from 'boardgame.io';

const baseUrl = `${window.location.protocol}//${window.location.hostname}:${API_PORT}`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { API_PORT, getDealtCard, ModelType, SPECTATOR } from '@eop/shared';
import type { BoardProps as BoardgameIOBoardProps } from 'boardgame.io/react';
import React, { FC, useCallback, useEffect, useState } from 'react';
import Model from '../model/model';
import request from 'superagent';

import Banner from '../banner/banner';
import Deck from '../deck/deck';
import Imprint from '../footer/imprint';
import Privacy from '../footer/privacy';
import ImageModel from '../imagemodel/imagemodel';
import LicenseAttribution from '../license/licenseAttribution';
import Model from '../model/model';
import PrivacyEnhancedModel from '../privacyEnhancedModel/privacyEnhancedModel';
import Sidebar from '../sidebar/sidebar';
import Status from '../status/status';
import Threatbar from '../threatbar/threatbar';
import ImageModel from '../imagemodel/imagemodel';
import Timer from '../timer/timer';

import './board.css';
import request from 'superagent';
import Status from '../status/status';
import { getDealtCard } from '../../../utils/utils';
import { ModelType, SPECTATOR } from '../../../utils/constants';
import LicenseAttribution from '../license/licenseAttribution';
import { API_PORT } from '../../../utils/serverConfig';
import PrivacyEnhancedModel from '../privacyEnhancedModel/privacyEnhancedModel';
import Imprint from '../footer/imprint';
import Privacy from '../footer/privacy';
import Banner from '../banner/banner';
import type { GameState } from '../../../game/gameState';
import type { ThreatDragonModel } from '../../../types/ThreatDragonModel';

import type { GameState, ThreatDragonModel } from '@eop/shared';

type BoardProps = Pick<
BoardgameIOBoardProps<GameState>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { DEFAULT_GAME_MODE } from '@eop/shared';
import React from 'react';
import ReactDOM from 'react-dom';

import DealtCard from './dealtcard';
import { DEFAULT_GAME_MODE } from '../../../utils/GameMode';

it('renders without crashing', () => {
const div = document.createElement('div');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GameMode, getCardCssClass } from '@eop/shared';
import type React from 'react';
import { GameMode, getCardCssClass } from '../../../utils/GameMode';
import type { Card } from '../../../utils/cardDefinitions';

import type { Card } from '@eop/shared';

interface DealtCardProps {
gameMode: GameMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DEFAULT_START_SUIT, GameMode } from '@eop/shared';
import React from 'react';
import ReactDOM from 'react-dom';

import Deck from './deck';
import { GameMode } from '../../../utils/GameMode';
import { DEFAULT_START_SUIT } from '../../../utils/constants';

it('renders without crashing', () => {
const div = document.createElement('div');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GameMode, getCardCssClass, getValidMoves } from '@eop/shared';

import type React from 'react';
import { getValidMoves } from '../../../utils/utils';
import { GameMode, getCardCssClass } from '../../../utils/GameMode';
import type { Card, Suit } from '../../../utils/cardDefinitions';
import type { Card, Suit } from '@eop/shared';

interface DeckProps {
suit?: Suit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { FC, ReactNode, useState } from 'react';
import { Button } from 'reactstrap';
import { API_PORT } from '@eop/shared';
import { faDownload, faTimes } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { API_PORT } from '../../../utils/serverConfig';
import React, { FC, ReactNode, useState } from 'react';
import { Button } from 'reactstrap';
import type { PlayerID } from 'boardgame.io';

type DownloadButtonProps = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type { FC } from 'react';
import packageJson from '../../../../package.json';
import packageJson from '../../../package.json';
import { faHeart } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Imprint from './imprint';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ div.deselect {
position: absolute;
height: 100%;
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { FC, useCallback, useEffect, useState } from 'react';
import './imagemodel.css';
import { MapInteractionCSS } from 'react-map-interaction';
import { asyncSetTimeout } from '../../../utils/utils';
import { API_PORT } from '../../../utils/serverConfig';
import { API_PORT, asyncSetTimeout } from '@eop/shared';
import type { PlayerID } from 'boardgame.io';

type ImageModelProps = {
Expand All @@ -11,16 +10,16 @@ type ImageModelProps = {
matchID: string;
};

const apiBase =
process.env.NODE_ENV === 'production'
? '/api'
: `${window.location.protocol}//${window.location.hostname}:${API_PORT}`;

const ImageModel: FC<ImageModelProps> = ({
playerID,
credentials,
matchID,
}) => {
const apiBase =
process.env.NODE_ENV === 'production'
? '/api'
: `${window.location.protocol}//${window.location.hostname}:${API_PORT}`;

const [imgSrc, setImgSrc] = useState<string | undefined>(undefined);

const updateImage = useCallback(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { DEFAULT_GAME_MODE } from '@eop/shared';
import { render, screen } from '@testing-library/react';
import React from 'react';

import Leaderboard from './leaderboard';
import { DEFAULT_GAME_MODE } from '../../../utils/GameMode';
import { render, screen } from '@testing-library/react';

describe('Leaderboard', () => {
it('renders without crashing', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { getCardDisplayName, Card as EOPCard } from '@eop/shared';
import type { PlayerID } from 'boardgame.io';
import React from 'react';
import type { FC } from 'react';
import { Badge, Card, CardHeader, Table } from 'reactstrap';
import {
getCardDisplayName,
Card as EOPCard,
} from '../../../utils/cardDefinitions';
import type { GameMode } from '../../../utils/GameMode';

import './leaderboard.css';

import type { GameMode } from '@eop/shared';

type LeaderboardProps = {
scores: number[];
names: string[];
Expand Down
7 changes: 7 additions & 0 deletions apps/client/src/components/license/licenseAttribution.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.license-attribution {
text-align: center;
font-size: 70%;
position: fixed;
bottom: 0;
right: 0;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GameMode } from '@eop/shared';
import { render, screen } from '@testing-library/react';
import React from 'react';
import { GameMode } from '../../../utils/GameMode';

import LicenseAttribution from './licenseAttribution';

describe('licence attribution', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GameMode } from '@eop/shared';
import type React from 'react';
import { GameMode } from '../../../utils/GameMode';

import './licenseAttribution.css';

interface LicenseAttributionProps {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React, { FC, useCallback, useEffect, useState } from 'react';
import classnames from 'classnames';
import * as joint from 'jointjs';
import React, { FC, useCallback, useEffect, useState } from 'react';
import { Nav, NavItem, NavLink } from 'reactstrap';
import Helmet from 'react-helmet';

import 'jointjs/dist/joint.css';

import '../../jointjs/joint-tm.css';
import '../../jointjs/shapes';
import { Nav, NavItem, NavLink } from 'reactstrap';
import classnames from 'classnames';

import './model.css';
import Helmet from 'react-helmet';
import type { ThreatDragonModel } from '../../../types/ThreatDragonModel';

import type { ThreatDragonModel } from '@eop/shared';

const SCROLL_SPEED = 1000;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DEFAULT_GAME_MODE, GameState, ModelType } from '@eop/shared';
import { render, screen } from '@testing-library/react';
import React from 'react';

import Sidebar from './sidebar';
import { DEFAULT_GAME_MODE } from '../../../utils/GameMode';
import { render, screen } from '@testing-library/react';
import type { GameState } from '../../../game/gameState';
import { ModelType } from '../../../utils/constants';

import type { Ctx } from 'boardgame.io';

describe('Sidebar', () => {
Expand Down
Loading

0 comments on commit 150eab8

Please sign in to comment.