Skip to content

Commit

Permalink
npm run fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham committed Mar 2, 2024
1 parent 9a3e368 commit 3ab2105
Show file tree
Hide file tree
Showing 72 changed files with 162 additions and 148 deletions.
4 changes: 2 additions & 2 deletions functions/src/generate-sessions-speakers-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const isScheduleEnabled = async (): Promise<boolean> => {
return doc.data().enabled === 'true' || doc.data().enabled === true;
} else {
functions.logger.error(
'Schedule config is not set. Set the `config/schedule.enabled=true` Firestore value.'
'Schedule config is not set. Set the `config/schedule.enabled=true` Firestore value.',
);
return false;
}
Expand Down Expand Up @@ -82,7 +82,7 @@ async function generateAndSaveData(changedSpeaker?) {
function saveGeneratedData(data: SessionMap | SpeakerMap | ScheduleMap, collectionName: string) {
if (isEmpty(data)) {
functions.logger.error(
`Attempting to write empty data to Firestore collection: "${collectionName}".`
`Attempting to write empty data to Firestore collection: "${collectionName}".`,
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion functions/src/mailchimp-subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ function subscribeToMailchimp(mailchimpConfig, subscriberData, emailHash?: strin
}
})
.catch((error) =>
functions.logger.error(`Error occured during Mailchimp subscription: ${error}`)
functions.logger.error(`Error occured during Mailchimp subscription: ${error}`),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export function sessionsSpeakersScheduleMap(sessionsRaw, speakersRaw, scheduleRa
day,
timeslotsIndex,
dayKey,
subSessionIndex
subSessionIndex,
);
const startTime = calculateStartTime(
subSessionsLen,
subSessionIndex,
sessionIndex,
sessions,
timeslot
timeslot,
);

dayTags = combineTags(dayTags, subsession?.tags);
Expand Down Expand Up @@ -76,7 +76,7 @@ export function sessionsSpeakersScheduleMap(sessionsRaw, speakersRaw, scheduleRa
speakersRaw,
subsession.speakers,
finalSubSession,
speakers
speakers,
),
};
}
Expand All @@ -87,8 +87,8 @@ export function sessionsSpeakersScheduleMap(sessionsRaw, speakersRaw, scheduleRa
sessionsLen !== 1
? sessionIndex + 2
: Object.keys(extensions).length
? Object.keys(extensions)[0]
: tracksNumber + 1;
? Object.keys(extensions)[0]
: tracksNumber + 1;
const start = `${timeslotsIndex + 1} / ${sessionIndex + 1}`;
const end = `${displayStart} / ${displayEnd}`;

Expand Down
20 changes: 10 additions & 10 deletions functions/src/schedule-notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const removeUserTokens = (tokensToUsers) => {
}, {});

transaction.set(ref, newVal);
})
}),
);
});

Expand All @@ -46,7 +46,7 @@ const sendPushNotificationToUsers = async (userIds: string[], payload: Messaging
'sendPushNotificationToUsers user ids',
userIds,
'with notification',
payload
payload,
);

const tokensPromise = userIds.map((id) => {
Expand Down Expand Up @@ -99,7 +99,7 @@ export const scheduleNotifications = functions.pubsub

const schedule = scheduleSnapshot.docs.reduce(
(acc, doc) => ({ ...acc, [doc.id]: doc.data() }),
{}
{},
);
const todayDay = moment().utcOffset(notificationsConfig.timezone).format('YYYY-MM-DD');

Expand All @@ -110,16 +110,16 @@ export const scheduleNotifications = functions.pubsub
const upcomingTimeslot = schedule[todayDay].timeslots.filter((timeslot) => {
const timeslotTime = moment(
`${timeslot.startTime}${notificationsConfig.timezone}`,
`${FORMAT}Z`
`${FORMAT}Z`,
).subtract(10, 'minutes');
return timeslotTime.isBetween(beforeTime, afterTime);
});

const upcomingSessions = upcomingTimeslot.reduce((_result, timeslot) =>
timeslot.sessions.reduce(
(aggregatedSessions, current) => [...aggregatedSessions, ...current.items],
[]
)
[],
),
);
const usersIdsSnapshot = await getFirestore().collection('featuredSessions').get();

Expand All @@ -132,20 +132,20 @@ export const scheduleNotifications = functions.pubsub

const usersIds = usersIdsSnapshot.docs.reduce(
(acc, doc) => ({ ...acc, [doc.id]: doc.data() }),
{}
{},
);

const userIdsFeaturedSession = Object.keys(usersIds).filter(
(userId) =>
!!Object.keys(usersIds[userId]).filter(
(sessionId) => sessionId.toString() === upcomingSession.toString()
).length
(sessionId) => sessionId.toString() === upcomingSession.toString(),
).length,
);

const session = sessionInfoSnapshot.data();
const end = moment(
`${upcomingTimeslot[0].startTime}${notificationsConfig.timezone}`,
`${FORMAT}Z`
`${FORMAT}Z`,
);
const fromNow = end.fromNow();

Expand Down
6 changes: 3 additions & 3 deletions functions/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const calculateStartTime = (
subSessionIndex: number,
sessionIndex: number,
sessions: any,
timeslot: any
timeslot: any,
) => {
return subSessionsLen > 1 && subSessionIndex > 0
? sessions[timeslot.sessions[sessionIndex].items[subSessionIndex - 1]].endTime
Expand All @@ -61,7 +61,7 @@ export const calculateEndTime = (
day: any,
timeslotsIndex: number,
dayKey: string,
subSessionIndex: number
subSessionIndex: number,
) => {
const endTimeRaw = timeslot.sessions[sessionIndex].extend
? day.timeslots[timeslotsIndex + timeslot.sessions[sessionIndex].extend - 1].endTime
Expand All @@ -77,7 +77,7 @@ const getEndTime = (
startTime: string,
endTime: string,
totalNumber: number,
number: number
number: number,
) => {
const timezone = new Date().toString().match(/([A-Z]+[+-][0-9]+.*)/)[1];
const timeStart = new Date(`${date} ${startTime} ${timezone}`).getTime();
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html itemscope itemtype="http://schema.org/Event" lang="en">
<head>
<base href="{{ basepath }}" />
Expand Down
2 changes: 1 addition & 1 deletion public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ async function unregisterAndClearCaches() {
}

unregisterAndClearCaches().catch((error) =>
console.error(`Error unregistering service worker: ${error}`)
console.error(`Error unregistering service worker: ${error}`),
);
2 changes: 1 addition & 1 deletion scripts/firestore-init/partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const importPartners = () => {
.doc(`${partnerId}`)
.collection('items')
.doc(`${id}`.padStart(3, '0')),
item
item,
);
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/firestore-init/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const importTeam = () => {
team.members.forEach((member, id) => {
batch.set(
firestore.collection('team').doc(`${teamId}`).collection('members').doc(`${id}`),
member
member,
);
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/components/about-block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('about-block', () => {

it('renders details', async () => {
const { shadowRootForWithin } = await fixture(
html`<about-block data-testid="block"></about-block>`
html`<about-block data-testid="block"></about-block>`,
);
const { getByText } = within(shadowRootForWithin);

Expand Down
14 changes: 6 additions & 8 deletions src/components/auth-required.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ describe('auth-required', () => {
let shadowRoot!: ShadowRoot;

beforeAll(async () => {
const render = await fixture<AuthRequired>(
html`
<auth-required>
<p slot="prompt">Please sign in</p>
<div>Welcome</div>
</auth-required>
`
);
const render = await fixture<AuthRequired>(html`
<auth-required>
<p slot="prompt">Please sign in</p>
<div>Welcome</div>
</auth-required>
`);

element = render.element;
shadowRoot = render.shadowRoot;
Expand Down
34 changes: 15 additions & 19 deletions src/components/hero/hero-block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ describe('hero-block', () => {
});

it('accepts values', async () => {
const { element, shadowRoot } = await fixture<HeroBlock>(
html`
<hero-block
background-image="/example.jpg"
background-color="#000"
font-color="#fff"
hide-logo
></hero-block>
`
);
const { element, shadowRoot } = await fixture<HeroBlock>(html`
<hero-block
background-image="/example.jpg"
background-color="#000"
font-color="#fff"
hide-logo
></hero-block>
`);
expect(element.backgroundImage).toBe('/example.jpg');
expect(element.backgroundColor).toBe('#000');
expect(element.fontColor).toBe('#fff');
Expand All @@ -50,14 +48,12 @@ describe('hero-block', () => {
});

it('displays slot elements', async () => {
const { shadowRoot } = await fixture<HeroBlock>(
html`
<hero-block>
<p>default slot</p>
<p slot="bottom">bottom slot</p>
</hero-block>
`
);
const { shadowRoot } = await fixture<HeroBlock>(html`
<hero-block>
<p>default slot</p>
<p slot="bottom">bottom slot</p>
</hero-block>
`);
const slots = shadowRoot.querySelectorAll('slot');
expect(slots).toHaveLength(2);
expect(screen.getByText('default slot')).toBeVisible();
Expand All @@ -70,7 +66,7 @@ describe('hero-block', () => {

it('renders an image', async () => {
const { shadowRoot } = await fixture<HeroBlock>(
html`<hero-block background-image="/example.jpg"></hero-block>`
html`<hero-block background-image="/example.jpg"></hero-block>`,
);
expect(shadowRoot.querySelector('.hero-image')).toHaveAttribute('src', '/example.jpg');
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/markdown/remote-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class RemoteMarkDown extends ThemedElement {
() => html``,
() => html`Loading...`,
() => html`Error loading content`,
(data) => html`<toc-markdown content="${data}"></toc-markdown>`
(data) => html`<toc-markdown content="${data}"></toc-markdown>`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/markdown/toc-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class TocMarkdown extends Markdown {
<div class="container">
<div class="content" layout justified horizontal wrap>
${Object.keys(this.headerIds).map((headerId) =>
this.renderHeader(headerId, this.headerIds[headerId]!)
this.renderHeader(headerId, this.headerIds[headerId]!),
)}
</div>
</div>
Expand Down
34 changes: 24 additions & 10 deletions src/elements/content-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,38 @@ export class ContentLoader extends PolymerElement {
var(--title-skeleton), var(--desc-line-skeleton), var(--desc-line-skeleton),
var(--avatar-skeleton), var(--footer-skeleton), var(--card-skeleton);
background-size: var(--blur-size), var(--title-width) var(--title-height),
background-size:
var(--blur-size),
var(--title-width) var(--title-height),
var(--desc-line-1-width) var(--desc-line-height),
var(--desc-line-2-width) var(--desc-line-height), var(--avatar-size) var(--avatar-size),
100% var(--footer-height), 100% 100%;
background-position: var(--load-from) 0, var(--title-position),
var(--desc-line-1-position), var(--desc-line-2-position), var(--avatar-position),
var(--footer-position), 0 0;
var(--desc-line-2-width) var(--desc-line-height),
var(--avatar-size) var(--avatar-size),
100% var(--footer-height),
100% 100%;
background-position:
var(--load-from) 0,
var(--title-position),
var(--desc-line-1-position),
var(--desc-line-2-position),
var(--avatar-position),
var(--footer-position),
0 0;
background-repeat: no-repeat;
animation: loading var(--animation-time) infinite;
}
@keyframes loading {
to {
background-position: var(--load-to) 0, var(--title-position),
var(--desc-line-1-position), var(--desc-line-2-position), var(--avatar-position),
var(--footer-position), 0 0;
background-position:
var(--load-to) 0,
var(--title-position),
var(--desc-line-1-position),
var(--desc-line-2-position),
var(--avatar-position),
var(--footer-position),
0 0;
}
}
</style>
Expand Down
4 changes: 2 additions & 2 deletions src/elements/featured-videos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ export class FeaturedVideos extends ReduxMixin(PolymerElement) {
const cardRect = lastVideo.getBoundingClientRect();
const cardWidth = cardRect.width;
const videosContainerWidth = parseInt(
getComputedStyle(this.videoList, null).getPropertyValue('width')
getComputedStyle(this.videoList, null).getPropertyValue('width'),
);
const videosWidth = parseInt(getComputedStyle(this.videosElm, null).getPropertyValue('width'));
const maxRightPosition = -(videosWidth - videosContainerWidth) - 16;
const currentPosition = parseInt(
getComputedStyle(this.videosElm, null).getPropertyValue('transform').split(',')[4] || ''
getComputedStyle(this.videosElm, null).getPropertyValue('transform').split(',')[4] || '',
);

return {
Expand Down
8 changes: 4 additions & 4 deletions src/elements/feedback-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class FeedbackBlock extends ReduxMixin(PolymerElement) {
contentRating: this.contentRating,
styleRating: this.styleRating,
comment: this.comment || '',
})
}),
);

if (setFeedback.fulfilled.match(resultAction)) {
Expand All @@ -153,7 +153,7 @@ export class FeedbackBlock extends ReduxMixin(PolymerElement) {
title: 'Retry',
callback: () => this.setFeedback(),
},
})
}),
);
}
}
Expand All @@ -172,7 +172,7 @@ export class FeedbackBlock extends ReduxMixin(PolymerElement) {
parentId: this.sessionId,
userId: this.user.data.uid,
id: this.user.data.uid,
})
}),
);

if (deleteFeedback.fulfilled.match(resultAction)) {
Expand All @@ -185,7 +185,7 @@ export class FeedbackBlock extends ReduxMixin(PolymerElement) {
title: 'Retry',
callback: () => this.deleteFeedback(),
},
})
}),
);
}
}
Expand Down
Loading

0 comments on commit 3ab2105

Please sign in to comment.