Skip to content

Commit 371bb6a

Browse files
committed
First real stable version
1 parent df8aabb commit 371bb6a

File tree

150 files changed

+8806
-2681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+8806
-2681
lines changed

.env

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,3 @@ APP_SECRET=f0e76683924b4f6c4ce6045019d3e1f6
1919
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
2020
#TRUSTED_HOSTS='^localhost|example\.com$'
2121
###< symfony/framework-bundle ###
22-
23-
###> symfony/mailer ###
24-
# MAILER_DSN=smtp://localhost
25-
###< symfony/mailer ###
26-
27-
###> doctrine/doctrine-bundle ###
28-
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
29-
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
30-
# For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
31-
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
32-
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7
33-
###< doctrine/doctrine-bundle ###

.env.test

Lines changed: 0 additions & 5 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
###> symfony/framework-bundle ###
32
/.env.local
43
/.env.local.php
@@ -8,8 +7,9 @@
87
/vendor/
98
###< symfony/framework-bundle ###
109

11-
###> symfony/phpunit-bridge ###
12-
.phpunit
13-
.phpunit.result.cache
14-
/phpunit.xml
15-
###< symfony/phpunit-bridge ###
10+
###> symfony/webpack-encore-bundle ###
11+
/node_modules/
12+
/public/build/
13+
npm-debug.log
14+
yarn-error.log
15+
###< symfony/webpack-encore-bundle ###

assets/css/app.scss

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
$screen-maxwheel: 767px;
2+
$big-wheel: 680px;
3+
$small-wheel: 330px;
4+
5+
body {
6+
font-family: Tahoma, Verdana, Segoe, sans-serif;
7+
background: #ddd;
8+
}
9+
10+
.layer-container {
11+
padding-top: 25px;
12+
13+
h1 {
14+
text-align: center;
15+
font-size: 1.5rem;
16+
}
17+
18+
.inner {
19+
position: relative;
20+
width: $big-wheel;
21+
height: $big-wheel;
22+
margin: 0 auto;
23+
24+
@media (max-width: $screen-maxwheel) {
25+
width: $small-wheel;
26+
height: $small-wheel;
27+
}
28+
29+
img {
30+
width: 100%;
31+
position: absolute;
32+
top: 0;
33+
left: 0;
34+
-webkit-transition: 1s ease-in-out;
35+
-moz-transition: 1s ease-in-out;
36+
-o-transition: 1s ease-in-out;
37+
transition: 1s ease-in-out;
38+
}
39+
}
40+
41+
.buttons-group-options {
42+
width: 300px !important;
43+
padding-top: 8px;
44+
margin: 0 auto;
45+
display: block;
46+
}
47+
}
48+
49+
.ganzhiyear-container {
50+
.center-number {
51+
position: absolute;
52+
font-weight: bold;
53+
display: block;
54+
width: 20px;
55+
text-align: center;
56+
margin: 0 auto;
57+
font-size: 18px;
58+
59+
top: ($big-wheel/2)-12;
60+
left: ($big-wheel/2)-11;
61+
62+
&.white {
63+
color: #000;
64+
}
65+
66+
&.black {
67+
color: #fff;
68+
}
69+
}
70+
71+
@media (max-width: $screen-maxwheel) {
72+
.center-number {
73+
top: ($small-wheel/2)-6;
74+
left: ($small-wheel/2)-9;
75+
font-size: 9px
76+
}
77+
}
78+
79+
}
80+
81+
.ganzhi-container {
82+
.inner {
83+
.position {
84+
position: absolute;
85+
display: block;
86+
width: 20px;
87+
text-align: center;
88+
}
89+
90+
.position-0 {
91+
bottom: 5px;
92+
left: ($big-wheel/2)-7;
93+
}
94+
95+
.position-1 {
96+
bottom: ($big-wheel/16)+6;
97+
left: ($big-wheel/4)+2;
98+
}
99+
100+
.position-2 {
101+
bottom: ($big-wheel/4)-5;
102+
left: ($big-wheel/12)-5;
103+
}
104+
105+
.position-3 {
106+
top: ($big-wheel/2)-11;
107+
left: 6px;
108+
}
109+
110+
.position-4 {
111+
top: ($big-wheel/4)-2;
112+
left: ($big-wheel/12)-6;
113+
}
114+
115+
.position-5 {
116+
top: ($big-wheel/16)+5;
117+
left: ($big-wheel/4)-1;
118+
}
119+
120+
.position-6 {
121+
top: 5px;
122+
left: ($big-wheel/2)-7;
123+
}
124+
125+
.position-7 {
126+
top: ($big-wheel/16)+5;
127+
right: ($big-wheel/4)-3;
128+
}
129+
130+
.position-8 {
131+
top: ($big-wheel/4)-2;
132+
right: ($big-wheel/12)-7;
133+
}
134+
135+
.position-9 {
136+
top: ($big-wheel/2)-12;
137+
right: 8px;
138+
}
139+
140+
.position-10 {
141+
bottom: ($big-wheel/4)-4;
142+
right: ($big-wheel/12)-7;
143+
}
144+
145+
.position-11 {
146+
bottom: ($big-wheel/16)+6;
147+
right: ($big-wheel/4)-3;
148+
}
149+
150+
@media (max-width: $screen-maxwheel) {
151+
.position {
152+
position: absolute;
153+
display: block;
154+
width: 10px;
155+
text-align: center;
156+
font-size: 9px;
157+
}
158+
.position-0 {
159+
bottom: 2px;
160+
left: ($small-wheel/2)-4;
161+
}
162+
.position-1 {
163+
bottom: ($small-wheel/16)+2;
164+
left: ($small-wheel/4);
165+
}
166+
.position-2 {
167+
bottom: ($small-wheel/4)-2;
168+
left: ($small-wheel/12)-3;
169+
}
170+
.position-3 {
171+
top: ($small-wheel/2)-6;
172+
left: 3px;
173+
}
174+
.position-4 {
175+
top: ($small-wheel/4)-2;
176+
left: ($small-wheel/12)-3;
177+
}
178+
.position-5 {
179+
top: ($small-wheel/16)+2;
180+
left: ($small-wheel/4)-1;
181+
}
182+
.position-6 {
183+
top: 2px;
184+
left: ($small-wheel/2)-4;
185+
}
186+
.position-7 {
187+
top: ($small-wheel/16)+2;
188+
right: ($small-wheel/4)-1;
189+
}
190+
.position-8 {
191+
top: ($small-wheel/4)-3;
192+
right: ($small-wheel/12)-4;
193+
}
194+
.position-9 {
195+
top: ($small-wheel/2)-6;
196+
right: 3px;
197+
}
198+
.position-10 {
199+
bottom: ($small-wheel/4)-2;
200+
right: ($small-wheel/12)-4;
201+
}
202+
.position-11 {
203+
bottom: ($small-wheel/16)+2;
204+
right: ($small-wheel/4)-1;
205+
}
206+
}
207+
208+
209+
}
210+
}
211+
212+
213+
nav {
214+
.year-change {
215+
padding-left: 5px;
216+
}
217+
218+
.current-header-date {
219+
font-size: 10px;
220+
color: #fff;
221+
padding-top: 5px;
222+
}
223+
224+
.form-inline input {
225+
width: 80px;
226+
max-width: 80px;
227+
text-align: center;
228+
}
229+
}
230+
231+
.row-year-change {
232+
padding-top: 15px;
233+
234+
.input-group {
235+
padding-bottom: 5px;
236+
}
237+
input {
238+
text-align: center;
239+
}
240+
}
241+
242+
.row-current-header-date {
243+
text-align: center;
244+
padding-top: 10px;
245+
font-size: 10px;
246+
}
247+
248+
249+
footer {
250+
position: fixed;
251+
bottom: 0;
252+
width: 100%;
253+
254+
p {
255+
text-align: center;
256+
margin: 0;
257+
font-size: 10px;
258+
color: #aaa;
259+
}
260+
}

assets/js/app.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'bootstrap/dist/css/bootstrap.min.css';
2+
import '../css/app.scss';
3+
4+
import React from 'react';
5+
import ReactDOM from 'react-dom';
6+
import MainContainer from "./components/MainContainer";
7+
8+
const container = document.getElementById('ganzhi-app');
9+
10+
declare global {
11+
interface Number {
12+
realModulo: (b: Number) => number;
13+
}
14+
}
15+
16+
Number.prototype.realModulo = function(b: number): number {
17+
return ((this % b) + b) % b;
18+
};
19+
20+
ReactDOM.render(<MainContainer/>, container);
21+
22+
if ('serviceWorker' in navigator) {
23+
window.addEventListener('load', function() {
24+
navigator.serviceWorker.register('/sw.js').then(function(registration) {
25+
console.log('ServiceWorker registration successful with scope: ', registration.scope);
26+
}, function(err) {
27+
console.log('ServiceWorker registration failed: ', err);
28+
});
29+
});
30+
}

assets/js/components/Ganzhi.tsx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import React, {useState} from 'react';
2+
import {GetRank} from '../functions';
3+
4+
import {
5+
ToggleButtonGroup,
6+
ToggleButton
7+
} from 'react-bootstrap';
8+
9+
export default function Ganzhi({year}) {
10+
const [value, setValue] = useState([]);
11+
const rank = GetRank(year);
12+
const diff = year - 4;
13+
const cycle = Math.floor(diff / 10).realModulo(6);
14+
const countGanZangfu = 6;
15+
const countYear = 12;
16+
const firstEmpty = 12 - (2 * (1 + cycle));
17+
const startNumberPosition = (firstEmpty + 2).realModulo(12);
18+
19+
const styles = {
20+
gan: {
21+
transform: "rotate(" + (cycle * -(360 / countGanZangfu)) + "deg)"
22+
},
23+
zangfu: {
24+
transform: "rotate(" + (cycle * -(360 / countGanZangfu)) + "deg)"
25+
},
26+
arrow: {
27+
transform: "rotate(" + ((diff % 12) * (360 / countYear)) + "deg)"
28+
}
29+
};
30+
31+
let bubles = [];
32+
const startCount = (cycle * 10) + 1;
33+
for (let i = 0; i < 12; i++) {
34+
bubles.push(startCount + i);
35+
}
36+
37+
const handleChange = val => setValue(val);
38+
39+
return <div className="ganzhi-container layer-container">
40+
<h1>Gan and Zhi Cycle</h1>
41+
<div className="inner">
42+
<img src="/images/ganzhi/arrow.png" style={styles.arrow}/>
43+
<img src="/images/ganzhi/background.png"/>
44+
<img src="/images/ganzhi/gan.png" style={styles.gan}/>
45+
46+
{value.includes("servants") && <img src="/images/ganzhi/servants.png"/>}
47+
{value.includes("hours") && <img src="/images/ganzhi/hours.png"/>}
48+
{value.includes("zangfu") && <img src="/images/ganzhi/zangfu.png" style={styles.zangfu}/>}
49+
<img src={"/images/zodiac/zodiac-" + rank + ".png"}/>
50+
{bubles.map((value, index) => {
51+
const indexPosition = (index + startNumberPosition).realModulo(12);
52+
let computedValue = value;
53+
if (indexPosition === firstEmpty || indexPosition === firstEmpty + 1) {
54+
computedValue = '';
55+
}
56+
return <span key={index} className={"position position-" + indexPosition}>{computedValue}</span>;
57+
})}
58+
</div>
59+
<ToggleButtonGroup type="checkbox" value={value} onChange={handleChange} className="buttons-group-options">
60+
<ToggleButton variant="outline-dark" value={"servants"}>Serviteurs</ToggleButton>
61+
<ToggleButton variant="outline-dark" value={"hours"}>Méridiens</ToggleButton>
62+
<ToggleButton variant="outline-dark" value={"zangfu"}>Zangfu</ToggleButton>
63+
</ToggleButtonGroup>
64+
</div>
65+
}

0 commit comments

Comments
 (0)