Skip to content

Commit e0f5cb0

Browse files
committed
chore: card & top btn css cleanup
card & top btn css cleanup; pwa; type declaration; clarr
1 parent 77a6a7d commit e0f5cb0

34 files changed

+1003
-1007
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public
1414

1515
dev-dist
1616

17+
src/styles/_variables.scss
18+
1719
package.json.bk
1820

1921
# MicrosoftOffice.gitignore

CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ _To ensure you're using the latest version, open the game and press <kbd>Ctrl</k
66

77
<!-- ## [v1.6.0](https://github.com/arcomage/arcomage-hd/compare/v1.5.0...v1.6.0) (2025-?-?) (in progress)
88
9-
- And more ([issue list](https://github.com/arcomage/arcomage-hd/issues?q=is%3Aissue+is%3Aclosed+closed%3A2025-02-24..*); [PR list](https://github.com/arcomage/arcomage-hd/pulls?q=is%3Apr+is%3Aclosed+merged%3A2025-02-24..*)) -->
9+
- And more ([issue list](https://github.com/arcomage/arcomage-hd/issues?q=is%3Aissue+is%3Aclosed+closed%3A2025-02-26..*); [PR list](https://github.com/arcomage/arcomage-hd/pulls?q=is%3Apr+is%3Aclosed+merged%3A2025-02-26..*)) -->
1010

11-
## [v1.5.0](https://github.com/arcomage/arcomage-hd/compare/v1.4.3...v1.5.0) (2025-02-23) (in beta testing phase)
11+
## [v1.5.0](https://github.com/arcomage/arcomage-hd/compare/v1.4.3...v1.5.0) (2025-02-25) (in beta testing phase)
1212

1313
- [Major Library changes](https://github.com/arcomage/arcomage-hd/issues/78)
1414
- Major Upgrade: React 19, Redux 5, RxJS 7.8, etc.
15-
- Removed: Webpack and related libs, Yarn, Jest and related libs, Enzyme, Testing Library, MUI, Husky, commitlint, classnames, copy-to-clipboard, some eslint plugins, ts-node, etc.
15+
- Removed: Webpack and related libs, Yarn, JSS, Jest and related libs, Enzyme, Testing Library, MUI, Husky, commitlint, classnames, copy-to-clipboard, some eslint plugins, ts-node, some polyfills (including pwacompat),etc.
1616
- Added: Bun, Vite, [React Compiler](https://react.dev/learn/react-compiler), clsx, etc.
1717
- [Automatic update (and/or showing notification) of the game in PWA or non PWA](https://github.com/arcomage/arcomage-hd/issues/106)
1818
- [Full control with mouse, touch device, keyboard, or gamepad](https://github.com/arcomage/arcomage-hd/issues/93) 🖱️📱⌨️🎮 ([instructions](gamecontrols.md)) (gamepad has basic support and is not fully finished)
@@ -26,7 +26,7 @@ _To ensure you're using the latest version, open the game and press <kbd>Ctrl</k
2626
- CI update, replaced husky git hooks with custom script
2727
- Docs update
2828
- Easter egg when clicking on birds
29-
- And more ([issue list](https://github.com/arcomage/arcomage-hd/issues?q=is%3Aissue+is%3Aclosed+closed%3A2025-01-26..2025-02-23); [PR list](https://github.com/arcomage/arcomage-hd/pulls?q=is%3Apr+is%3Aclosed+merged%3A2025-01-26..2025-02-23))
29+
- And more ([issue list](https://github.com/arcomage/arcomage-hd/issues?q=is%3Aissue+is%3Aclosed+closed%3A2025-01-26..2025-02-25); [PR list](https://github.com/arcomage/arcomage-hd/pulls?q=is%3Apr+is%3Aclosed+merged%3A2025-01-26..2025-02-25))
3030

3131
## [v1.4.0](https://github.com/arcomage/arcomage-hd/compare/v1.3.0...v1.4.3) ([2025-01-25](https://github.com/arcomage/arcomage-hd/tree/552bf596a98d403310345efe7afc7c067938d489))
3232

DEVELOPMENT.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Install dependencies:
66
- `bun install`
77
- Start the project in development mode:
8-
- `bun start`
8+
- `bun dev`
99
- Before releasing a new version, run the checks:
1010
- `bun checkall`
1111
- `git add .`
@@ -30,8 +30,8 @@
3030
- `bun install`: Install dependencies
3131
- `bun install:nooptional`: Install dependencies without optional dependencies (temporarily remove optional dependencies in package.json and re-add them after install. Used by CI)
3232
- `bun upgrade`: Upgrade dependencies to the latest compatible versions
33-
- `bun start`: Start the project in development mode
34-
- `bun start --host` or `bun preview --host`: Run the project in development/production mode and expose it to the local network (on devices on the same wifi/network, go to `http://192.168.?.?:PORT` to view the app)
33+
- `bun dev`: Start the project in development mode
34+
- `bun dev --host` or `bun preview --host`: Run the project in development/production mode and expose it to the local network (on devices on the same wifi/network, go to `http://192.168.?.?:PORT` to view the app)
3535
- `./tools/manifest` generates json object of `manifest.json` and icon files from ./assets/logo/, it runs automatically before each start or build, see `vite.config.ts`
3636
- `bun run build`: Build the project in production mode
3737
- `bun preview`: Preview the built project in production mode (does not include build process)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ The stack :
108108
<a href="https://vite.dev/" title="Vite"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/vite.svg" alt="Vite" width="21px" height="21px"></a>
109109
<a href="https://sass-lang.com/" title="Sass"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/sass.svg" alt="Sass" width="21px" height="21px"></a>
110110
<a href="https://tailwindcss.com/" title="Tailwind CSS"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/tailwindcss-icon.svg" alt="Tailwind CSS" width="21px" height="21px"></a>
111-
<a href="https://cssinjs.org/" title="JSS"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/jss.svg" alt="JSS" width="21px" height="21px"></a>
112111
<a href="https://prettier.io/" title="Prettier"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/prettier.svg" alt="Prettier" width="21px" height="21px"></a>
113112
<a href="https://eslint.org/" title="ESLint"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/eslint.svg" alt="ESLint" width="21px" height="21px"></a>
114113
<a href="https://github.com/postcss/postcss" title="PostCSS"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/postcss.svg" alt="PostCSS" width="21px" height="21px"></a>
@@ -127,6 +126,7 @@ Used in ≤1.4 but not in 1.5+:
127126
<p align="center">
128127
<a href="https://yarnpkg.com/" title="yarn"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/yarn.svg" alt="yarn" width="21px" height="21px"></a>
129128
<a href="https://webpack.js.org/" title="webpack"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/webpack.svg" alt="webpack" width="21px" height="21px"></a>
129+
<a href="https://cssinjs.org/" title="JSS"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/jss.svg" alt="JSS" width="21px" height="21px"></a>
130130
<a href="https://material-ui.com/" title="Material-UI"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/material-ui.svg" alt="Material-UI" width="21px" height="21px"></a>
131131
<a href="https://jestjs.io/" title="Jest"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/jest.svg" alt="Jest" width="21px" height="21px"></a>
132132
<a href="https://github.com/enzymejs/enzyme" title="Enzyme"><img src="https://raw.githubusercontent.com/arcomage/arcomage-hd/main/misc/readme_images/stack/enzyme.svg" alt="Enzyme" width="21px" height="21px"></a>

bun.lock

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"clsx": "^2.1.1",
1111
"immer": "^10.1.1",
1212
"peerjs": "^1.5.4",
13-
"pwacompat": "^2.0.17",
1413
"react": "^19.0.0",
1514
"react-dom": "^19.0.0",
1615
"react-helmet-async": "^2.0.5",
@@ -1709,8 +1708,6 @@
17091708

17101709
"punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
17111710

1712-
"pwacompat": ["[email protected]", "", {}, "sha512-6Du7IZdIy7cHiv7AhtDy4X2QRM8IAD5DII69mt5qWibC2d15ZU8DmBG1WdZKekG11cChSu4zkSUGPF9sweOl6w=="],
1713-
17141711
"qs": ["[email protected]", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
17151712

17161713
"query-string": ["[email protected]", "", { "dependencies": { "decode-uri-component": "^0.2.0", "object-assign": "^4.1.0", "strict-uri-encode": "^1.0.0" } }, "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw=="],

index.html

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
66
<title>%APP_TITLE%</title>
77
<link rel="canonical" href="%APP_URL%" />
8-
<link rel="manifest" href="%APP_PWAMANIFESTJSON%" />
98
<link rel="icon" type="image/svg+xml" href="%APP_FAVICONSVG%" />
109
<link rel="alternate icon" href="%APP_FAVICONICO%" />
1110
<meta name="title" content="%APP_TITLE%" data-rh="true" />

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
},
99
"scripts": {
1010
"install:nooptional": "bun tools/rm-optional-deps/remove.ts && bun install && bun tools/rm-optional-deps/restore.ts",
11-
"start": "vite",
11+
"dev": "vite",
1212
"build": "vite build",
1313
"preview": "vite preview",
1414
"checkall": "bun format && bun lint && bun typecheck && bun test",
1515
"format": "prettier --check '**/*.{ts,tsx,js,jsx,mjs,mjsx,cjs,cjsx}'",
1616
"lint": "eslint",
1717
"typecheck": "tsc --noEmit",
1818
"version": "bun ./tools/version/bump.ts",
19+
"sassvar": "bun ./tools/sass-var-gen",
1920
"tool:zhconvert": "bun ./tools/zhconvert",
2021
"tool:imgpc": "bun ./tools/img-processing/crop && bun ./tools/img-processing/upscale",
2122
"tool:imgmin": "bun ./tools/img-min/index.ts",
@@ -64,7 +65,6 @@
6465
"clsx": "^2.1.1",
6566
"immer": "^10.1.1",
6667
"peerjs": "^1.5.4",
67-
"pwacompat": "^2.0.17",
6868
"react": "^19.0.0",
6969
"react-dom": "^19.0.0",
7070
"react-helmet-async": "^2.0.5",
@@ -147,4 +147,4 @@
147147
"last 1 edge version"
148148
]
149149
}
150-
}
150+
}

src/components/Card.module.scss

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
@use '../styles/_variables.scss' as *;
2+
3+
$cardGradient: linear-gradient(
4+
to left,
5+
rgba(
6+
$cardGradientSideRgb,
7+
$cardGradientSideRgb,
8+
$cardGradientSideRgb,
9+
$cardGradientSideOpacity
10+
),
11+
rgba(0, 0, 0, 0),
12+
rgba(
13+
$cardGradientSideRgb,
14+
$cardGradientSideRgb,
15+
$cardGradientSideRgb,
16+
$cardGradientSideOpacity
17+
)
18+
);
19+
20+
.main {
21+
// 'will-change: opacity' has bug and cannot be set here
22+
will-change: transform, left, top;
23+
transition-property: opacity, transform, left, top;
24+
transition-timing-function: ease-in-out;
25+
transition-duration: #{$cardTransitionDuration}ms;
26+
}
27+
.cardname {
28+
@apply m-1 shadow text-center tracking-tight;
29+
height: calc(var(--cardwidth) * 0.094 * 1.1);
30+
line-height: calc(var(--cardwidth) * 0.094 * 1.1);
31+
}
32+
.isflipped {
33+
transform: translateX(-100%) translateZ(0) rotateY(-179.99deg);
34+
}
35+
.cardeffect {
36+
@apply absolute rounded;
37+
transform-style: preserve-3d;
38+
transform-origin: center right;
39+
}
40+
.cardfront {
41+
@apply absolute top-0 bottom-0 left-0 right-0 rounded;
42+
background-image: url('../../assets/img/noise.webp');
43+
backface-visibility: hidden;
44+
will-change: transform, left, top;
45+
transition-property: opacity, transform, left, top;
46+
transition-timing-function: ease-in-out;
47+
transition-duration: #{$cardTransitionDuration}ms;
48+
&::before {
49+
width: 100%;
50+
height: 100%;
51+
position: absolute;
52+
top: 0;
53+
left: 0;
54+
content: '';
55+
background: $cardGradient;
56+
}
57+
}
58+
.unusableopacity {
59+
opacity: $unusableCardOpacity;
60+
}
61+
.cardback {
62+
@apply absolute top-0 bottom-0 left-0 right-0 rounded;
63+
will-change: transform, left, top;
64+
transition-property: opacity, transform, left, top;
65+
transition-timing-function: ease-in-out;
66+
transition-duration: #{$cardTransitionDuration}ms;
67+
transform: translateX(0) translateZ(0) rotateY(180deg);
68+
backface-visibility: hidden;
69+
&::before {
70+
width: 100%;
71+
height: 100%;
72+
position: absolute;
73+
top: 0;
74+
left: 0;
75+
content: '';
76+
background: $cardGradient;
77+
}
78+
}
79+
.cardbackhard {
80+
@apply absolute rounded shadow-lg;
81+
&::before {
82+
width: 100%;
83+
height: 100%;
84+
position: absolute;
85+
top: 0;
86+
left: 0;
87+
content: '';
88+
background: $cardGradient;
89+
}
90+
}
91+
.cardbackimage {
92+
@apply w-full h-full bg-cover;
93+
background-image: url('../../assets/img/cardback.webp');
94+
background-size: cover;
95+
background-position: center;
96+
background-repeat: no-repeat;
97+
}
98+
.imagewrapper {
99+
@apply relative m-1 shadow bg-no-repeat bg-cover bg-center;
100+
// width: calc(100% - 0.25rem * 2),
101+
height: calc((100% / 63 * 47 - 0.5rem) / 22 * 13);
102+
}
103+
.imageholder {
104+
@apply w-full h-full bg-cover;
105+
}
106+
.discarded {
107+
@apply absolute top-0 left-0 w-full h-full flex justify-center items-center text-red-500 font-bold uppercase text-shadow-stroke;
108+
font-size: 125%;
109+
}
110+
.text {
111+
@apply m-2 flex flex-wrap items-center justify-center;
112+
// width: calc(100% - 0.25rem * 2),
113+
height: calc(
114+
100% - (var(--cardwidth) * 0.094 * 1.1 + 0.25rem + 0.25rem) -
115+
(0.5rem + 0.5rem) - (100% / 63 * 47 - 0.5rem) / 22 * 13
116+
);
117+
}
118+
.textholder {
119+
@apply leading-tight break-words text-center;
120+
}
121+
.resall {
122+
@apply absolute bottom-1 right-1 text-center font-bold;
123+
width: calc(var(--cardwidth) * 0.2);
124+
height: calc(var(--cardwidth) * 0.2);
125+
line-height: calc(var(--cardwidth) * 0.2);
126+
}
127+
.resbg {
128+
@apply absolute top-0 left-0 w-full h-full;
129+
background-repeat: no-repeat;
130+
background-size: cover;
131+
background-position: center center;
132+
opacity: $resbgOpacity;
133+
&.brick {
134+
background-image: url('../../assets/img/brick.svg');
135+
}
136+
&.gem {
137+
background-image: url('../../assets/img/gem.svg');
138+
}
139+
&.recruit {
140+
background-image: url('../../assets/img/recruit.svg');
141+
}
142+
}
143+
.cost {
144+
@apply absolute top-0 left-0 w-full h-full;
145+
}

0 commit comments

Comments
 (0)