Skip to content

Commit

Permalink
feat: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SylarLong committed Jan 2, 2024
1 parent 09dcebd commit 664a450
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 46 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
},
"dependencies": {
"classnames": "^2.3.2",
"iztro": "2.2.1",
"iztro-hook": "1.2.9",
"lunar-lite": "^0.0.3"
"iztro": "2.2.2",
"iztro-hook": "1.2.10",
"lunar-lite": "^0.1.1"
},
"resolutions": {
"jackspeak": "2.1.1"
Expand Down
20 changes: 20 additions & 0 deletions src/IzpalaceCenter/IzpalaceCenter.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,24 @@
}
#palace-line.decadal {
stroke: var(--iztro-color-decadal);
}

.solar-horoscope {
display: flex;
align-items: center;
gap: 10px;
}

.solar-horoscope .today {
display: inline-block;
font-size: var(--iztro-star-font-size-small);
cursor: pointer;
border: 1px solid var(--iztro-color-border);
padding: 0 5px;
transition: all 0.25s ease-in-out;
}

.solar-horoscope .today:hover {
color: var(--iztro-color-major);
background-color: var(--iztro-color-border);
}
45 changes: 16 additions & 29 deletions src/IzpalaceCenter/IzpalaceCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { normalizeDateStr, solar2lunar } from "lunar-lite";
import { GenderName, kot, t } from "iztro/lib/i18n";
import { CHINESE_TIME } from "iztro/lib/data";

const MIN_DATETIME = new Date(1990, 0, 31).getTime();
const MAX_DATETIME = new Date(2101, 0, 1).getTime();

type IzpalaceCenterProps = {
astrolabe?: FunctionalAstrolabe;
horoscope?: IFunctionalHoroscope;
Expand Down Expand Up @@ -142,11 +139,7 @@ export const IzpalaceCenter = ({
break;
}

if (
dt.getTime() > MIN_DATETIME &&
dt.getTime() < MAX_DATETIME &&
dt.getTime() >= birthday.getTime()
) {
if (dt.getTime() >= birthday.getTime()) {
setHoroscopeDate?.(dt);
setHoroscopeHour?.(hour);
}
Expand Down Expand Up @@ -186,11 +179,7 @@ export const IzpalaceCenter = ({
break;
}

if (
dt.getTime() >= MAX_DATETIME ||
dt.getTime() <= MIN_DATETIME ||
dt.getTime() < birthday.getTime()
) {
if (dt.getTime() < birthday.getTime()) {
return true;
}

Expand Down Expand Up @@ -228,7 +217,15 @@ export const IzpalaceCenter = ({
<h3 className="center-title">运限信息</h3>
<ul className="basic-info">
<Item title="农历:" content={horoDate.lunar} />
<Item title="阳历:" content={horoDate.solar} />
<div className={classNames("solar-horoscope")}>
<Item title="阳历:" content={horoDate.solar} />
<span
className="today"
onClick={() => setHoroscopeDate?.(new Date())}
>
</span>
</div>
</ul>
<div className="horo-buttons">
<span
Expand Down Expand Up @@ -275,41 +272,31 @@ export const IzpalaceCenter = ({
{t(CHINESE_TIME[horoscopeHour])}
</span>
<span
className={classNames("center-button", {
disabled: shouldBeDisabled(horoDate.solar, "hourly", 1),
})}
className={classNames("center-button")}
onClick={() => onHoroscopeButtonClicked("hourly", 1)}
>
时▶
</span>
<span
className={classNames("center-button", {
disabled: shouldBeDisabled(horoDate.solar, "daily", 1),
})}
className={classNames("center-button")}
onClick={() => onHoroscopeButtonClicked("daily", 1)}
>
日▶
</span>
<span
className={classNames("center-button", {
disabled: shouldBeDisabled(horoDate.solar, "monthly", 1),
})}
className={classNames("center-button")}
onClick={() => onHoroscopeButtonClicked("monthly", 1)}
>
月▶
</span>
<span
className={classNames("center-button", {
disabled: shouldBeDisabled(horoDate.solar, "yearly", 1),
})}
className={classNames("center-button")}
onClick={() => onHoroscopeButtonClicked("yearly", 1)}
>
年▶
</span>
<span
className={classNames("center-button", {
disabled: shouldBeDisabled(horoDate.solar, "yearly", 10),
})}
className={classNames("center-button")}
onClick={() => onHoroscopeButtonClicked("yearly", 10)}
>
限▶
Expand Down
35 changes: 21 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5761,21 +5761,21 @@ istanbul-reports@^3.1.4:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"

[email protected].9:
version "1.2.9"
resolved "https://registry.npmjs.org/iztro-hook/-/iztro-hook-1.2.9.tgz#d2402ff14b293668db7f17655520d35d399d9f07"
integrity sha512-rs9RGXTXoFtoJJoh4WnQCVDI7I1t6l3D6U+GU0358AcxakVrbVAHyw0HboMd2HVs7Uxg3g3zHQoLHttGwU9+RQ==
[email protected].10:
version "1.2.10"
resolved "https://registry.npmjs.org/iztro-hook/-/iztro-hook-1.2.10.tgz#a367704a888a23036c9713b1ab18c8e032d44c33"
integrity sha512-q5BOR0zMEFON8tsxRrGQHBBzB7zZ/ltH55WjvOXKrw420M/xamoacA10lwWtFc1wUX1UeRfrgONq/fAjFpp6rQ==
dependencies:
iztro "2.2.1"
iztro "2.2.2"

[email protected].1:
version "2.2.1"
resolved "https://registry.npmjs.org/iztro/-/iztro-2.2.1.tgz#a3aa9d4bae133c615d9d8ef5bcea4ba8e7d4260d"
integrity sha512-9ODRwH/LSwq58GblZsa+eP0nEow4Lx9zupyPR7GT61wWMZSS6DZ7/o6bDlSFpm9WUG11QDoIyacgDeZT39B1cw==
[email protected].2:
version "2.2.2"
resolved "https://registry.npmjs.org/iztro/-/iztro-2.2.2.tgz#60929834554fa9c5d31fee83610f634900d4ef7e"
integrity sha512-3CnGQbGtakQtJB9KkmYQqOt+VZZ1zVokwn96pxvW1LXV+BVb/6cdpBkTwOpZPJ/a4z2GZ32ft7bkpMjwun63Zg==
dependencies:
dayjs "^1.11.10"
i18next "^23.5.1"
lunar-lite "^0.0.3"
lunar-lite "^0.1.1"

[email protected], jackspeak@^2.0.3:
version "2.1.1"
Expand Down Expand Up @@ -6096,10 +6096,17 @@ lru-cache@^6.0.0:
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a"
integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==

lunar-lite@^0.0.3:
version "0.0.3"
resolved "https://registry.npmjs.org/lunar-lite/-/lunar-lite-0.0.3.tgz#c0a053fb6d585a91c6496352208e28d6ff2c2dde"
integrity sha512-J6K/MU8CLTqBPfijc5u+wnYlxvZAS3k5knjfUakZoz2XTkOB0HerUgXNHyZS2be389J4GSYaUKvDk8mps0sNdQ==
lunar-lite@^0.1.1:
version "0.1.1"
resolved "https://registry.npmjs.org/lunar-lite/-/lunar-lite-0.1.1.tgz#c2c114b95eae24b84ebc0702f616ed573772c244"
integrity sha512-ttdkDY4uZg6LtE8r4m/Vt+z48ReT8StYXPY2eXqJ6tOG3C4I11g/f/gAJXplJIRTZd+F1xOFa52tUiP2UIkqzQ==
dependencies:
lunar-typescript "^1.6.13"

lunar-typescript@^1.6.13:
version "1.6.13"
resolved "https://registry.npmjs.org/lunar-typescript/-/lunar-typescript-1.6.13.tgz#99c9975f8ba4bc43af813e0155db0926d024cbcf"
integrity sha512-6gBJepWWRiCvpbxxeiogsd/ZIggBbH1xmS090Kat/FiM0AGFnso0bmYXL1q/opr8qrMdnjsBlMZqBvNiRKACGA==

lz-string@^1.5.0:
version "1.5.0"
Expand Down

0 comments on commit 664a450

Please sign in to comment.