Skip to content

Commit 00810eb

Browse files
LeTeddyhsluoyz
authored andcommitted
feat: improve dark mode UI (casibase#1438)
1 parent 9ab754e commit 00810eb

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

web/src/ActivityPage.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,6 @@ class ActivityPage extends BaseListPage {
350350
showLoading={this.state["activities" + dataName] === undefined}
351351
loadingOption={{
352352
color: localStorage.getItem("themeColor"),
353-
textColor: "#000",
354-
maskColor: "rgba(255, 255, 255, 0.8)",
355353
fontSize: "16px",
356354
spinnerRadius: 6,
357355
lineWidth: 3,
@@ -386,8 +384,6 @@ class ActivityPage extends BaseListPage {
386384
showLoading={activitiesAction === undefined}
387385
loadingOption={{
388386
color: localStorage.getItem("themeColor"),
389-
textColor: "#000",
390-
maskColor: "rgba(255, 255, 255, 0.8)",
391387
fontSize: "16px",
392388
spinnerRadius: 6,
393389
lineWidth: 3,
@@ -408,8 +404,6 @@ class ActivityPage extends BaseListPage {
408404
showLoading={activitiesAction === undefined}
409405
loadingOption={{
410406
color: localStorage.getItem("themeColor"),
411-
textColor: "#000",
412-
maskColor: "rgba(255, 255, 255, 0.8)",
413407
fontSize: "16px",
414408
spinnerRadius: 6,
415409
lineWidth: 3,

web/src/App.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,11 @@ class App extends Component {
336336
setLogoAndThemeAlgorithm = (nextThemeAlgorithm) => {
337337
this.setState({
338338
themeAlgorithm: nextThemeAlgorithm,
339-
logo: this.getLogo(nextThemeAlgorithm),
339+
logo: Setting.getLogo(nextThemeAlgorithm),
340340
});
341341
localStorage.setItem("themeAlgorithm", JSON.stringify(nextThemeAlgorithm));
342342
};
343343

344-
getLogo(themes) {
345-
return Setting.getLogo(themes);
346-
}
347-
348344
renderAvatar() {
349345
if (this.state.account.avatar === "") {
350346
return (
@@ -821,7 +817,7 @@ class App extends Component {
821817
<div style={{display: "flex", alignItems: "center", flex: 1, overflow: "hidden"}}>
822818
{Setting.isMobile() ? null : (
823819
<Link to={"/"}>
824-
<img className="logo" src={this.getLogo(this.state.themeAlgorithm)} alt="logo" />
820+
<img className="logo" src={Setting.getLogo(this.state.themeAlgorithm)} alt="logo" />
825821
</Link>
826822
)}
827823
{Setting.isMobile() ? (
@@ -868,7 +864,7 @@ class App extends Component {
868864
height: "67px",
869865
}
870866
}>
871-
<div dangerouslySetInnerHTML={{__html: Conf.FooterHtml}} />
867+
<div dangerouslySetInnerHTML={{__html: Setting.getFooterHtml(this.state.themeAlgorithm)}} />
872868
</Footer>
873869
</React.Fragment>
874870
);

web/src/Setting.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,3 +2058,13 @@ export function getLogo(themes) {
20582058
return defaultLogoUrl;
20592059
}
20602060
}
2061+
2062+
export function getFooterHtml(themes) {
2063+
let FooterHtml = Conf.FooterHtml;
2064+
FooterHtml = FooterHtml.replace("https://cdn.casibase.org", Conf.StaticBaseUrl);
2065+
if (themes.includes("dark")) {
2066+
return FooterHtml.replace(/(\.png)/g, "_white$1");
2067+
} else {
2068+
return FooterHtml;
2069+
}
2070+
}

web/src/UsagePage.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,6 @@ class UsagePage extends BaseListPage {
521521
trigger: "axis",
522522
axisPointer: {
523523
type: "cross",
524-
crossStyle: {
525-
color: "#999",
526-
},
527524
},
528525
},
529526
legend: {
@@ -661,13 +658,10 @@ class UsagePage extends BaseListPage {
661658
height: "400px",
662659
width: "100%",
663660
display: "inline-block",
664-
backgroundColor: "#fff",
665661
}}
666662
showLoading={this.state.usages === null}
667663
loadingOption={{
668664
color: localStorage.getItem("themeColor"),
669-
textColor: "#000",
670-
maskColor: "rgba(255, 255, 255, 0.8)",
671665
fontSize: "16px",
672666
spinnerRadius: 6,
673667
lineWidth: 3,
@@ -683,13 +677,10 @@ class UsagePage extends BaseListPage {
683677
height: "400px",
684678
width: "100%",
685679
display: "inline-block",
686-
backgroundColor: "#fff",
687680
}}
688681
showLoading={this.state.usages === null}
689682
loadingOption={{
690683
color: localStorage.getItem("themeColor"),
691-
textColor: "#000",
692-
maskColor: "rgba(255, 255, 255, 0.8)",
693684
fontSize: "16px",
694685
spinnerRadius: 6,
695686
lineWidth: 3,
@@ -714,13 +705,10 @@ class UsagePage extends BaseListPage {
714705
height: "400px",
715706
width: "48%",
716707
display: "inline-block",
717-
backgroundColor: "#fff",
718708
}}
719709
showLoading={rangeUsages === null}
720710
loadingOption={{
721711
color: localStorage.getItem("themeColor"),
722-
textColor: "#000",
723-
maskColor: "rgba(255, 255, 255, 0.8)",
724712
fontSize: "16px",
725713
spinnerRadius: 6,
726714
lineWidth: 3,
@@ -734,13 +722,10 @@ class UsagePage extends BaseListPage {
734722
height: "400px",
735723
width: "48%",
736724
display: "inline-block",
737-
backgroundColor: "#fff",
738725
}}
739726
showLoading={rangeUsages === null}
740727
loadingOption={{
741728
color: localStorage.getItem("themeColor"),
742-
textColor: "#000",
743-
maskColor: "rgba(255, 255, 255, 0.8)",
744729
fontSize: "16px",
745730
spinnerRadius: 6,
746731
lineWidth: 3,
@@ -755,7 +740,7 @@ class UsagePage extends BaseListPage {
755740

756741
render() {
757742
return (
758-
<div style={{backgroundColor: "white"}}>
743+
<div>
759744
<Row style={{marginTop: "20px"}} >
760745
<Col span={1} />
761746
<Col span={17} >

0 commit comments

Comments
 (0)