Skip to content

Commit 0fe72ac

Browse files
authored
fix(#1180): autoprogress toggle (#1191)
fix: news image won't scale enh: scaling columns and the timer panel at different breakpoints
1 parent a8a65f0 commit 0fe72ac

File tree

6 files changed

+337
-3715
lines changed

6 files changed

+337
-3715
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

components/HubPanelWrap.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
},
99
render() {
1010
return (
11-
<b-col md={4} data-packer-item="true" class="panel-header binpacker-item mt-2">
11+
<b-col sm={12} lg={6} xl={4} data-packer-item="true" class="panel-header binpacker-item mt-2">
1212
<h4 className="text-center header-panel">{this.title}</h4>
1313
{this.$slots.default}
1414
</b-col>

components/panels/AggregatedTimePanel.jsx

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ const fontStyle = {
3333
left: '5px',
3434
};
3535

36+
const TimerPanel = {
37+
name: 'TimerPanel',
38+
render() {
39+
return <div class="col-xs-3 col-sm-4 col-lg-6 my-3">{this.$slots.default}</div>;
40+
},
41+
};
42+
3643
const EarthTimer = {
3744
props: ['earthCycle'],
3845
computed: {
@@ -48,7 +55,7 @@ const EarthTimer = {
4855
},
4956
render() {
5057
return (
51-
<div class="col-sm-3 my-3">
58+
<TimerPanel>
5259
<span style={textStyle}>
5360
{this.$t(`location.earth`)}
5461
<br />
@@ -64,7 +71,7 @@ const EarthTimer = {
6471
interval={1000}
6572
pullright={false}
6673
/>
67-
</div>
74+
</TimerPanel>
6875
);
6976
},
7077
};
@@ -83,7 +90,7 @@ const CetusTimer = {
8390
},
8491
render() {
8592
return (
86-
<div class="col-sm-3 my-3">
93+
<TimerPanel>
8794
<span style={textStyle}>
8895
{this.$t(`location.cetus`)}
8996
<br />
@@ -99,7 +106,7 @@ const CetusTimer = {
99106
interval={1000}
100107
pullright={false}
101108
/>
102-
</div>
109+
</TimerPanel>
103110
);
104111
},
105112
};
@@ -118,7 +125,7 @@ const VallisTimer = {
118125
},
119126
render() {
120127
return (
121-
<div class="col-sm-3 my-3">
128+
<TimerPanel>
122129
<span style={textStyle}>
123130
{this.$t(`location.vallis`)}
124131
<br />
@@ -135,7 +142,7 @@ const VallisTimer = {
135142
interval={1000}
136143
pullright={false}
137144
/>
138-
</div>
145+
</TimerPanel>
139146
);
140147
},
141148
};
@@ -151,7 +158,7 @@ const CambionTimer = {
151158
},
152159
render() {
153160
return (
154-
<div class="col-sm-3 my-3">
161+
<TimerPanel>
155162
<span style={textStyle}>
156163
{this.$t(`location.cambion`)}
157164
<br />
@@ -167,7 +174,7 @@ const CambionTimer = {
167174
interval={1000}
168175
pullright={false}
169176
/>
170-
</div>
177+
</TimerPanel>
171178
);
172179
},
173180
};
@@ -182,15 +189,15 @@ const ResetTimer = {
182189
},
183190
render() {
184191
return (
185-
<div class="col-sm-3 my-3">
192+
<TimerPanel>
186193
<b-tooltip placement="auto" class="text-center" target="daily-reset">
187194
{this.$t('reset.tooltip')}
188195
</b-tooltip>
189196
<span style={textStyle}>{this.$t('reset.header')}</span>
190197
<i class="fas fa-info-circle fa-sm pl-1" id="daily-reset" style={textStyle} />
191198
<br />
192199
<TimeBadge starttime={this.now} endtime={this.nextDay} interval={1000} pullright={false} />
193-
</div>
200+
</TimerPanel>
194201
);
195202
},
196203
};
@@ -203,7 +210,7 @@ const AnomalyTimer = {
203210
},
204211
render() {
205212
return (
206-
<div class="col-sm-3 my-3 text-center">
213+
<TimerPanel class="text-center">
207214
<span style={textStyle}>{this.$t('sentientoutpost.header')}</span>
208215
<i
209216
class={'icon-factions-sentient fa-lg'}
@@ -216,15 +223,15 @@ const AnomalyTimer = {
216223
<b>{this.sentientOutposts.mission.node}</b>
217224
<br />
218225
{this.sentientOutposts.mission.type}
219-
</div>
226+
</TimerPanel>
220227
);
221228
},
222229
};
223230
const SteelPathTimer = {
224231
props: ['steelPath'],
225232
render() {
226233
return (
227-
<div class="col-sm-3 my-3">
234+
<TimerPanel>
228235
<span style={textStyle}>{this.$t('steelPath.header')}</span>
229236
<HubImg
230237
src={steelPath}
@@ -251,7 +258,7 @@ const SteelPathTimer = {
251258
interval={1000}
252259
pullright={false}
253260
/>
254-
</div>
261+
</TimerPanel>
255262
);
256263
},
257264
};
@@ -264,7 +271,7 @@ const ArbitrationTimer = {
264271
},
265272
render() {
266273
return (
267-
<div class="col-sm-3 my-3">
274+
<TimerPanel>
268275
<span style={textStyle}>{this.$t('arbitration.header')}</span>
269276
<i class={`icon-factions-${this.enemy}`} style={{ ...fontStyle }} />
270277
<br />
@@ -277,7 +284,7 @@ const ArbitrationTimer = {
277284
interval={1000}
278285
pullright={false}
279286
/>
280-
</div>
287+
</TimerPanel>
281288
);
282289
},
283290
};
@@ -293,7 +300,7 @@ const ZarimanTimer = {
293300
},
294301
render() {
295302
return (
296-
<div class="col-sm-3 my-3">
303+
<TimerPanel>
297304
<span style={textStyle}>
298305
{this.$t(`location.zariman`)}
299306
<br />
@@ -309,7 +316,7 @@ const ZarimanTimer = {
309316
interval={1000}
310317
pullright={false}
311318
/>
312-
</div>
319+
</TimerPanel>
313320
);
314321
},
315322
};

components/panels/NewsPanel.vue

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,33 @@ import relativeTime from 'dayjs/plugin/relativeTime';
5656
import updateLocale from 'dayjs/plugin/updateLocale';
5757
import { mapGetters } from 'vuex';
5858
import HubPanelWrap from '@/components/HubPanelWrap.jsx';
59+
60+
import { optimize, cdn } from '@/services/utilities';
61+
5962
dayjs.extend(relativeTime);
6063
dayjs.extend(updateLocale);
6164
62-
const cdnUrl = 'https://cdn.warframestat.us';
63-
const cdnOpts = ['o_webp', 'rs_404x110'];
65+
const newsImg = (url) => optimize(url, '404x110', 'scale');
6466
6567
export default {
6668
name: 'NewsPanel',
6769
components: { HubPanelWrap },
68-
props: ['news'],
70+
props: {
71+
news: {
72+
type: Array,
73+
required: true,
74+
},
75+
},
76+
data() {
77+
return {
78+
styleObject: {
79+
display: 'inline',
80+
},
81+
activeElemIndex: 0,
82+
interval: {},
83+
hover: null,
84+
};
85+
},
6986
computed: {
7087
headertext() {
7188
return this.$t('news.header');
@@ -79,8 +96,7 @@ export default {
7996
},
8097
set() {
8198
this.hover = null;
82-
this.cycle = !this.cycle;
83-
this.$store.commit('worldstate/autoProgressNews', [this.cycle]);
99+
this.$store.commit('worldstate/autoProgressNews', [!this.cycle]);
84100
},
85101
},
86102
...mapGetters('worldstate', ['componentState', 'locale']),
@@ -131,7 +147,12 @@ export default {
131147
this.increment();
132148
},
133149
getImgSrc: (url) => {
134-
return `${cdnUrl}/${cdnOpts.join(',')}/${url}`;
150+
switch (url) {
151+
case 'https://i.imgur.com/CNrsc7V.png':
152+
return newsImg(cdn('img/news-placeholder.png'));
153+
default:
154+
return newsImg(url);
155+
}
135156
},
136157
title: function (newsitem) {
137158
if (newsitem.startDate && newsitem.endDate) {
@@ -159,16 +180,6 @@ export default {
159180
}
160181
},
161182
},
162-
data() {
163-
return {
164-
styleObject: {
165-
display: 'inline',
166-
},
167-
activeElemIndex: 0,
168-
interval: {},
169-
hover: null,
170-
};
171-
},
172183
};
173184
</script>
174185
<style scoped>

0 commit comments

Comments
 (0)