Skip to content

Commit

Permalink
Add enlarged toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
HSZemi committed Aug 18, 2021
1 parent 01c04d0 commit 7e5cf46
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 4 deletions.
23 changes: 21 additions & 2 deletions src/components/draft/Draft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface IState {
joined: boolean;
flipped: boolean;
smooch: boolean;
enlarged: boolean;
simplifiedUI: boolean;
}

Expand All @@ -64,7 +65,8 @@ class Draft extends React.Component<IProps, IState> {
const flipped = query.get('flipped') === 'true' || false;
const smooch = query.get('smooch') === 'true' || false;
const simplifiedUI = query.get('simplified') === 'true' || false;
this.state = {joined: false, flipped, smooch, simplifiedUI};
const enlarged = query.get('enlarged') === 'true' || false;
this.state = {joined: false, flipped, smooch, simplifiedUI, enlarged};
}


Expand Down Expand Up @@ -143,7 +145,6 @@ class Draft extends React.Component<IProps, IState> {
}

private toggleSimplifiedUI():void{
console.log('Simplified UI Toggle')
const newSimplifiedUIValue = !this.state.simplifiedUI;
let searchParams = new URLSearchParams(this.props.location.search);
searchParams.set('simplified', newSimplifiedUIValue.toString());
Expand All @@ -153,6 +154,16 @@ class Draft extends React.Component<IProps, IState> {
this.setState({...this.state, simplifiedUI: newSimplifiedUIValue});
}

private toggleEnlarged():void{
const newEnlargedValue = !this.state.enlarged;
let searchParams = new URLSearchParams(this.props.location.search);
searchParams.set('enlarged', newEnlargedValue.toString());
this.props.history.replace({
search: searchParams.toString()
});
this.setState({...this.state, enlarged: newEnlargedValue});
}

public render() {
let presetName: JSX.Element = <>{this.props.preset.name}</>;
if(this.props.preset.presetId){
Expand All @@ -163,6 +174,7 @@ class Draft extends React.Component<IProps, IState> {
let className = 'section';
className += this.state.flipped ? ' flipped' : '';
className += this.state.smooch ? ' smooch' : '';
className += this.state.enlarged ? ' enlarged' : '';

if(this.state.simplifiedUI) {
ColorSchemeHelpers.addThemeClassName('has-simple-ui');
Expand Down Expand Up @@ -235,6 +247,13 @@ class Draft extends React.Component<IProps, IState> {
}}/>
<label htmlFor="toggleSimplifiedUI" style={{paddingTop:1}}><Trans i18nKey='simplifiedUI'>Simplified UI</Trans></label>
</p>
<p className="control">
<input id="toggleEnlarged" type="checkbox" name="toggleEnlarged"
className="switch is-small is-rounded is-info" checked={this.state.enlarged} onChange={() => {
this.toggleEnlarged()
}}/>
<label htmlFor="toggleEnlarged" style={{paddingTop:1}}><Trans i18nKey='enlarged'>Enlarge Panels</Trans></label>
</p>
</div>
</div>
</section>
Expand Down
1 change: 1 addition & 0 deletions src/languages/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"flip": "Vertausche die Positionen von Host und Gast",
"smooch": "Knutschmodus umschalten",
"simplifiedUI": "schlichte Darstellung",
"enlarged": "Panels vergrößern",
"validationFailed": "Validierungsfehler:",
"errors": {
"VLD_000": "Draft erwartet derzeit keine Aktion",
Expand Down
1 change: 1 addition & 0 deletions src/languages/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"flip": "Flip Host and Guest positions",
"smooch": "Smooch mode",
"simplifiedUI": "Simplified UI",
"enlarged": "Enlarge Panels",
"validationFailed": "Validation(s) failed:",
"errors": {
"VLD_000": "Draft is currently not expecting actions",
Expand Down
3 changes: 2 additions & 1 deletion src/languages/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
"<0></0>BAN": "<0></0>BAN",
"flip": "Voltear posiciones de Anfitrión e Invitado",
"smooch": "Modo de beso",
"simplifiedUI": "Interfaz Simplificada",
"simplifiedUI": "Interfaz simplificada",
"enlarged": "Agrandar paneles",
"validationFailed": "Fallaron la/s validaciónes:",
"errors": {
"VLD_000": "El Draft no esta esperando acciónes",
Expand Down
3 changes: 2 additions & 1 deletion src/languages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"flip": "Inverta a posição do Anfitrião e do Convidado",
"smooch": "Alternar modo smooch",
"simplifiedUI": "IU simplificada",
"enlarged": "Ampliar Painéis",
"validationFailed": "A(s) validação(ões) falhou(aram):",
"errors": {
"VLD_000": "O draft não está esperando por ações atualmente",
Expand Down Expand Up @@ -254,7 +255,7 @@
"admin": "Administrador",
"new": "Novo",
"presetName": "Nome da Definição",
"warning": "<0>Atenção!</0><1/>Isso é algo avançado,e você provavelmente não vai precisar disso se você quer criar um draft normal com as civilizações antigas.<3/><4>Por favor, use as urls de imagem que você espera que estejam funcionando daqui a dez anos ou mais!</4>",
"warning": "<0>Atenção!</0><1/>Isso é algo avançado, e você provavelmente não vai precisar disso se você quer criar um draft normal com as civilizações antigas.<3/><4>Por favor, use as urls de imagem que você espera que estejam funcionando daqui a dez anos ou mais!</4>",
"option": {
"name": "Nome",
"unitImageUrl": "URL da imagem da unidade",
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
"<0></0>BAN": "<0></0>禁",
"flip": "左右交换",
"smooch": "面对面开关",
"simplifiedUI": "简化UI",
"enlarged": "放大界面",
"validationFailed": "错误提示:",
"errors": {
"VLD_000": "现在无需任何操作",
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
"<0></0>BAN": "<0></0>禁",
"flip": "左右交換",
"smooch": "面對面開關",
"simplifiedUI": "簡化版介面",
"enlarged": "放大面板",
"validationFailed": "錯誤提示:",
"errors": {
"VLD_000": "現在無需任何操作",
Expand Down
24 changes: 24 additions & 0 deletions src/sass/bulma.scss
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,26 @@ div.stretchy-wrapper > div.stretchy-text {
height: 80px;
}

.enlarged .pick {
width: 150px;
height: 150px;
}

.enlarged .steal {
width: 150px;
height: 150px;
}

.enlarged .ban {
width: 120px;
height: 120px;
}

.pick, .steal, .ban {
transition: width .6s, height .6s;
}


.pick .stretchy-background {
background: $pick-green;
}
Expand Down Expand Up @@ -850,6 +870,10 @@ html.has-simple-ui {
width: 112px;
height: 112px;
}
.enlarged .ban {
width: 150px;
height: 150px;
}

.ban .random-pick {
top: 0;
Expand Down

0 comments on commit 7e5cf46

Please sign in to comment.