diff --git a/gen_calendar.py b/gen_calendar.py
index 1bce514..3c08a0d 100644
--- a/gen_calendar.py
+++ b/gen_calendar.py
@@ -83,7 +83,7 @@ def main():
'start_year': fr_year(int(equinoxes[0].ut1_calendar()[0])),
'leap': [int(paris_jdn(b) - paris_jdn(a) == 366) for a, b in zip(equinoxes, equinoxes[1:])]
}
- with open('cal.json', 'w') as f:
+ with open('src/cal.json', 'w') as f:
json.dump(result, f, separators=(',', ':'))
diff --git a/src/App.tsx b/src/App.tsx
index a53698a..598e66e 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,25 +1,10 @@
import React from 'react';
-import logo from './logo.svg';
import './App.css';
+import {Calendar} from './Calendar';
function App() {
return (
-
+
);
}
diff --git a/src/Calendar.tsx b/src/Calendar.tsx
new file mode 100644
index 0000000..c66a5d7
--- /dev/null
+++ b/src/Calendar.tsx
@@ -0,0 +1,57 @@
+import React from 'react';
+import {Day, decadeNames, frJDN, Month} from './dates';
+
+type MonthProps = {
+ year: number;
+ month: Month;
+};
+
+type DateProps = MonthProps & {
+ day: Day;
+};
+
+export type CalendarProps = DateProps & {
+ year: number;
+ month: Month;
+ onSwitch?: (year: number, month: Month, day: Day) => void,
+};
+
+type CalendarState = {};
+
+function DecadeName({name}: { name: string }): JSX.Element {
+ return {name} | ;
+}
+
+function DayDetail({jdn}: { jdn: number }): JSX.Element {
+ return ;
+}
+
+function NormalDay({year, month, day, isToday}: DateProps & { isToday: boolean }): JSX.Element {
+ return
+ {day}
+
+ | ;
+}
+
+function NormalMonth({year, month}: MonthProps): JSX.Element {
+ const decadeHeads = decadeNames.map(name => );
+ return
+
+ {decadeHeads}
+
+ {
+ Array.from(Array(3).keys()).map(i => {
+ Array.from(Array(10).keys()).map(j =>
+ )
+ }
)
+ }
+
;
+}
+
+export class Calendar extends React.Component {
+ render(): JSX.Element {
+ return ;
+ }
+}
diff --git a/cal.json b/src/cal.json
similarity index 100%
rename from cal.json
rename to src/cal.json
diff --git a/src/dates.ts b/src/dates.ts
index b356829..5ff5cc0 100644
--- a/src/dates.ts
+++ b/src/dates.ts
@@ -1,4 +1,4 @@
-import data from '../cal.json';
+import data from './cal.json';
// Month 13 is for the complementary days
export type Month = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
@@ -52,6 +52,10 @@ const monthNames: {
13: 'Jours Complémentaires',
};
+export const decadeNames = [
+ 'primidi', 'duodi', 'tridi', 'quartidi', 'quintidi', 'sextidi', 'septidi', 'octidi', 'nonidi', 'décadi',
+];
+
const startJD = data.start_jd;
const startYear = data.start_year;
const leaps: Array = [0];
@@ -84,13 +88,20 @@ export function monthName(month: Month): string {
export function dateName(month: Month, day: Day): string | null {
if (month === 13) {
switch (day) {
- case 1: return 'La Fête de la Vertu';
- case 2: return 'La Fête du Génie';
- case 3: return 'La Fête du Travail';
- case 4: return "La Fête de l'Opinion";
- case 5: return 'La Fête des Récompenses';
- case 6: return 'La Fête de la Révolution';
- default: return null;
+ case 1:
+ return 'La Fête de la Vertu';
+ case 2:
+ return 'La Fête du Génie';
+ case 3:
+ return 'La Fête du Travail';
+ case 4:
+ return "La Fête de l'Opinion";
+ case 5:
+ return 'La Fête des Récompenses';
+ case 6:
+ return 'La Fête de la Révolution';
+ default:
+ return null;
}
}
return `${day} ${monthNames[month]}`;