Skip to content

Commit 04f4420

Browse files
fix: Handle undefined text color (#4851)
1 parent 4880985 commit 04f4420

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

app/helpers/text-color.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ import Helper from '@ember/component/helper';
33

44
// inputs: bg color, dark color (chosen if bg is light), light color (chosen if bg is dark)
55
export default Helper.helper(function(params: string[]): string {
6-
return getTextColor(params[0], params[1], params[2]);
6+
const color = params[0];
7+
if (!color) {return '#000'}
8+
return getTextColor(color, params[1], params[2]);
79
});

app/routes/public/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import moment from 'moment';
55
import { set } from '@ember/object';
66
import ENV from 'open-event-frontend/config/environment';
77
import { allSettled } from 'rsvp';
8+
import { SPEAKERS_FILTER } from './speakers';
89

910
@classic
1011
export default class IndexRoute extends Route {
@@ -37,9 +38,11 @@ export default class IndexRoute extends Route {
3738
name : 'is-featured',
3839
op : 'eq',
3940
val : 'true'
40-
}
41+
},
42+
...SPEAKERS_FILTER
4143
],
42-
'page[size]': 0
44+
include : 'sessions.track',
45+
'page[size]' : 0
4346
});
4447
const sponsorsPromise = event.get('sponsors');
4548
const taxPromise = event.get('tax');

app/templates/components/public/speaker-item.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
</p>
5454
{{/if}}
5555
<a href="{{href-to 'public.sessions' (query-params session_id=session.id)}}">
56-
<div class="ui fluid rounded-default p-4" style={{css color=session.track.fontColor background-color=session.track.color}}>
56+
<div class="ui fluid rounded-default p-4" style={{css color=(text-color session.track.color) background-color=session.track.color}}>
5757
<div style={{css opacity=0.9}}>
5858
{{#if (and session.startsAt session.endsAt)}}
5959
<strong>{{general-date session.startsAt @timezone 'HH:mm'}} - {{general-date session.endsAt @timezone 'hh:mm'}}</strong>
6060
{{/if}}
61-
<h3 class="m-0" style={{css user-select='text' color=(text-color session.track.color)}}>
61+
<h3 class="m-0" style={{css user-select='text'}}>
6262
{{session.title}}
6363
</h3>
6464
</div>

0 commit comments

Comments
 (0)