Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added option to reverse the sort order #121

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Combatants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Combatants extends Component {
/>
)
}
return <div className="combatants">{rows}</div>
return <div className={`combatants ${this.props.config.reverseOrder ? 'combatants-reversed' : ''}`}>{rows}</div>
}
}

Expand Down
275 changes: 118 additions & 157 deletions src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,94 @@ class ConfigRaw extends Component {
render() {
let { config } = this.state
const loc = locale[config.locale].config

const checkboxFieldsToChange = [
{
name: 'showRank',
id: 'showRank',
defaultChecked: config.showRank,
label: loc.toggleOption1
},
{
name: 'showJobIcon',
id: 'showJobIcon',
defaultChecked: config.showJobIcon,
label: loc.toggleOption2
},
{
name: 'showHps',
id: 'showHps',
defaultChecked: config.showHps,
label: loc.toggleOption3
},
{
name: 'showHighlight',
id: 'showHighlight',
defaultChecked: config.showHighlight,
label: loc.toggleOption4
},
{
name: 'showSelf',
id: 'showSelf',
defaultChecked: config.showSelf,
label: loc.toggleOption5
},
{
name: 'showMaxhit',
id: 'showMaxhit',
defaultChecked: config.showMaxhit,
label: loc.toggleOption11
},
{
name: 'showDuration',
id: 'showDuration',
defaultChecked: config.showDuration,
label: loc.toggleOption6
},
{
name: 'showTotalDps',
id: 'showTotalDps',
defaultChecked: config.showTotalDps,
label: loc.toggleOption7
},
{
name: 'showDamagePercent',
id: 'showDamagePercent',
defaultChecked: config.showDamagePercent,
label: loc.toggleOption8
},
{
name: 'showJobless',
id: 'showJobless',
defaultChecked: config.showJobless,
label: loc.toggleOption12
},
{
name: 'showDiscord',
id: 'showDiscord',
defaultChecked: config.showDiscord,
label: loc.toggleOption9
},
{
name: 'showLocale',
id: 'showLocale',
defaultChecked: config.showLocale,
label: loc.toggleOption10
},
{
name: 'reverseOrder',
id: 'reverseOrder',
defaultChecked: config.reverseOrder,
label: loc.toggleOption14
},
{
name: 'enableStreamerMode',
id: 'enableStreamerMode',
defaultChecked: config.enableStreamerMode,
label: loc.toggleOption13
}
]

return (
<div className="config" style={{ zoom: config.zoom }}>
<form onSubmit={(e) => this.resetConfig(e)}>
Expand Down Expand Up @@ -113,167 +201,40 @@ class ConfigRaw extends Component {
</label>
</div>
</fieldset>
<fieldset className="fieldsToShow">
<fieldset>
<legend>
{/* Check to Show */}
{loc.toggleTitle}
</legend>
<input
type="checkbox"
name="showRank"
id="showRank"
defaultChecked={config.showRank}
onChange={this.handleConfig}
/>
<label htmlFor="showRank">
{/* Rank # */}
{loc.toggleOption1}
</label>
<input
type="checkbox"
name="showJobIcon"
id="showJobIcon"
defaultChecked={config.showJobIcon}
onChange={this.handleConfig}
/>
<label htmlFor="showJobIcon">
{/* Job Icon */}
{loc.toggleOption2}
</label>
<input
type="checkbox"
name="showHps"
id="showHps"
defaultChecked={config.showHps}
onChange={this.handleConfig}
/>
<label htmlFor="showHps">
{/* HPS */}
{loc.toggleOption3}
</label>
<input
type="checkbox"
name="showHighlight"
id="showHighlight"
defaultChecked={config.showHighlight}
onChange={this.handleConfig}
/>
<label htmlFor="showHighlight">
{/* Highlight */}
{loc.toggleOption4}
</label>
<input
type="checkbox"
name="showSelf"
id="showSelf"
defaultChecked={config.showSelf}
onChange={this.handleConfig}
/>
<label htmlFor="showSelf">
{/* Self */}
{loc.toggleOption5}
</label>
<input
type="checkbox"
name="showMaxhit"
id="showMaxhit"
defaultChecked={config.showMaxhit}
onChange={this.handleConfig}
/>
<label htmlFor="showMaxhit">
{/* Self */}
{loc.toggleOption11}
</label>
<br />
<input
type="checkbox"
name="showDuration"
id="showDuration"
defaultChecked={config.showDuration}
onChange={this.handleConfig}
/>
<label htmlFor="showDuration">
{/* Duration */}
{loc.toggleOption6}
</label>
<input
type="checkbox"
name="showTotalDps"
id="showTotalDps"
defaultChecked={config.showTotalDps}
onChange={this.handleConfig}
/>
<label htmlFor="showTotalDps">
{/* Total DPS */}
{loc.toggleOption7}
</label>
<input
type="checkbox"
name="showDamagePercent"
id="showDamagePercent"
defaultChecked={config.showDamagePercent}
onChange={this.handleConfig}
/>
<label htmlFor="showDamagePercent">
{/* Damage % */}
{loc.toggleOption8}
</label>
<input
type="checkbox"
name="showJobless"
id="showJobless"
defaultChecked={config.showJobless}
onChange={this.handleConfig}
/>
<label htmlFor="showJobless">
{/* Self */}
{loc.toggleOption12}
</label>
<input
type="checkbox"
name="showDiscord"
id="showDiscord"
defaultChecked={config.showDiscord}
onChange={this.handleConfig}
/>
<label htmlFor="showDiscord">
{/* Discord */}
{loc.toggleOption9}
</label>
<input
type="checkbox"
name="showLocale"
id="showLocale"
defaultChecked={config.showLocale}
onChange={this.handleConfig}
/>
<label htmlFor="showLocale">
{/* Language */}
{loc.toggleOption10}
</label>
<input
type="checkbox"
name="enableStreamerMode"
id="enableStreamerMode"
defaultChecked={config.enableStreamerMode}
onChange={this.handleConfig}
/>
<label htmlFor="enableStreamerMode">
{/* Enbale Streamer Mode (blur names) */}
{loc.toggleOption13}
</label>
<div className="combatants">
<label htmlFor="maxCombatants">
{/* # Combatants */}
{loc.maxCombatantsTitle}
</label>
<input
type="text"
id="maxCombatants"
name="maxCombatants"
value={config.maxCombatants}
onChange={this.handleConfig}
/>
<div className="checkboxFieldsToChange">
{checkboxFieldsToChange.map(field => (
<div>
<input
type="checkbox"
name={field.name}
id={field.id}
defaultChecked={field.defaultChecked}
onChange={this.handleConfig}
/>
<label htmlFor={field.id}>
{field.label}
</label>
</div>
))}
<div className="combatants">
<label htmlFor="maxCombatants">
{/* # Combatants */}
{loc.maxCombatantsTitle}
</label>
<input
type="text"
id="maxCombatants"
name="maxCombatants"
value={config.maxCombatants}
onChange={this.handleConfig}
/>
</div>

</div>
</fieldset>
<fieldset className="fieldsZoom">
Expand Down
2 changes: 1 addition & 1 deletion src/SetupMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function SetupModeRaw(props) {
style={{ zoom: props.config.zoom }}
>
<div className={`wrapper ${isVisible}`}>
<div className="combatants">
<div className={`combatants ${props.config.reverseOrder ? 'combatants-reversed' : ''}`}>
{mockData.map((mock, index) => {
if (index >= maxCombatants) return false
let maxhit
Expand Down
7 changes: 7 additions & 0 deletions src/css/config.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fieldset {
border-image: initial;
text-align: center;
flex: 1;
height: 200px;
overflow-y: auto;
}
.fieldsToShow {
flex: 3;
Expand All @@ -32,6 +34,11 @@ form {
display: flex;
}

.checkboxFieldsToChange {
text-align: left;
margin-left: 20px;
}

/* form div:first-of-type {
display: flex;
align-items: flex-start;
Expand Down
5 changes: 5 additions & 0 deletions src/css/setupMode.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
display: flex;
text-align: center;
}

.combatants-reversed {
flex-direction: row-reverse;
}

.row {
flex: 1;
text-shadow: 0 0 8px #000;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const defaultConfig = {
locale: 'enUS',
configWindow: {
width: 1300,
height: 239
height: 258
},
colorHealer: 'rgba(139, 195, 74, 0.3)',
colorTank: 'rgba(33, 150, 243, 0.3)',
Expand Down
5 changes: 5 additions & 0 deletions src/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const locale = {
toggleOption10: 'Language',
toggleOption11: 'Max Hit',
toggleOption12: 'Show "jobless" Combatants',
toggleOption14: 'Reverse display order',
toggleOption13: 'Enable streamer mode (blur all names)',
maxCombatantsTitle: 'Max Combatants',
zoomTitle: 'Zoom Scale',
Expand Down Expand Up @@ -82,6 +83,7 @@ const locale = {
toggleOption10: 'Língua',
toggleOption11: 'Max Hit',
toggleOption12: 'Show "jobless" Combatants',
toggleOption14: 'Reverse display order',
toggleOption13: 'Enable streamer mode (blur all names)',
maxCombatantsTitle: 'Máx. Personagens',
zoomTitle: 'Escala de Zoom',
Expand Down Expand Up @@ -140,6 +142,7 @@ const locale = {
toggleOption10: '模版语言',
toggleOption11: '最强伤害',
toggleOption12: 'Show "jobless" Combatants',
toggleOption14: 'Reverse display order',
toggleOption13: 'Enable streamer mode (blur all names)',
maxCombatantsTitle: '最强战员',
zoomTitle: '缩放尺寸',
Expand Down Expand Up @@ -198,6 +201,7 @@ const locale = {
toggleOption10: '模版語言',
toggleOption11: '最強傷害',
toggleOption12: 'Show "jobless" Combatants',
toggleOption14: 'Reverse display order',
toggleOption13: 'Enable streamer mode (blur all names)',
maxCombatantsTitle: '最強戰員',
zoomTitle: '縮放尺寸',
Expand Down Expand Up @@ -256,6 +260,7 @@ const locale = {
toggleOption10: 'Langage',
toggleOption11: 'Max Hit',
toggleOption12: 'Afficher les combatants sans Job',
toggleOption14: 'Reverse display order',
toggleOption13: 'Enable streamer mode (blur all names)',
maxCombatantsTitle: 'Combatants max',
zoomTitle: 'Échelle',
Expand Down