Skip to content

Commit

Permalink
add jp support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsmithepic committed May 29, 2022
1 parent 2e74635 commit 76d0739
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
38 changes: 34 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,49 @@ import { exportComponentAsPNG } from 'react-component-export-image';

class App extends Component {
state = {

lang: "en"
};

exportButtonStyle = {
fontSize: 30,
fontWeight: 'bold'
}

getWtfMessage(){
if(this.state.lang === "en"){
return "please view in desktop since idk how to make things work on mobile";
} else {
return "サイトとか作るの初めてなのでケータイとかでこのサイト見るとめちゃくちゃになります。。。すいません";
}
}

getLangButtonClasses = (lang) => {
var className = "btn btn-sm ml-2 mr-2 btn-";
console.log("wtf: " + lang + " " + this.state.lang);
if(this.state.lang === lang){
className += "primary";
} else {
className += "secondary";
}
return className;
}

handleLangChange = (lang) => {
this.setState({lang});
}

render(){
const printRef = React.createRef();


return (
<React.Fragment>
<div className="mt-5">
<Favs key="ok" className="mt-3" ref={printRef}></Favs>
<div className="text-center mt-3">
<button style={this.exportButtonStyle} onClick={() => this.handleLangChange("en")} className={this.getLangButtonClasses("en")}>EN</button>
<button style={this.exportButtonStyle} onClick={() => this.handleLangChange("jp")} className={this.getLangButtonClasses("jp")}>日本語</button>
</div>
<div className="mt-3">
<Favs key="ok" className="mt-3" ref={printRef} lang={this.state.lang}></Favs>
<div className="text-center mt-5 mb-5">
<button style={this.exportButtonStyle} onClick={() => exportComponentAsPNG(printRef)} className="btn btn-secondary btn-sm">
Export to PNG
Expand All @@ -32,7 +60,9 @@ class App extends Component {
<div className="text-center mb-5 text-muted">
All characters/assets belong to Cygames and Nintendo
<div></div>
please view in desktop since idk how to make things work on mobile
{this.getWtfMessage()}
<div></div>
hello twitter!
</div>
</React.Fragment>
);
Expand Down
14 changes: 9 additions & 5 deletions src/components/Favs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import OutsideClickHandler from './OutsideClickHandler';
const unknownImg = require("../resources/misc/unknown.png");

const logo = require("../resources/misc/logo_app.png");
const favsTitle = require("../resources/misc/favs.png");

class Favs extends Component {
state = {
Expand Down Expand Up @@ -100,7 +99,12 @@ class Favs extends Component {
}
}


getSelfPlugText(){
if(this.props.lang === "en"){
return "Made in sockperson.github.io/dragalia-faves";
}
return "テンプレ sockperson.github.io/dragalia-faves";
}

render() {
const eles = this.state.elements;
Expand All @@ -116,7 +120,7 @@ class Favs extends Component {
<div className="row justify-content-center">
<div className="row justify-content-center">
<img src={logo} className="col-3 thumbnail img-responsive"/>
<img src={favsTitle} className="col-7 thumbnail img-responsive"/>
<img src={require("../resources/misc/favs_" + this.props.lang + ".png")} className="col-7 thumbnail img-responsive"/>
</div>
<div></div>
{weps.map(wep => (
Expand All @@ -127,8 +131,8 @@ class Favs extends Component {
</React.Fragment>
))
))}
<div className="row justify-content-center">
<p className="col-5 h4 mt-2 mb-2 text-muted text-nowrap">Made in sockperson.github.io/dragalia-faves</p>
<div className="text-center">
<p className="h4 mt-2 mb-2 text-muted text-nowrap">{this.getSelfPlugText()}</p>
</div>
</div>
</OutsideClickHandler>
Expand Down
File renamed without changes
Binary file added src/resources/misc/favs_jp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76d0739

Please sign in to comment.