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

refactor: Template of Certificates #323

Merged
merged 1 commit into from
Dec 4, 2023
Merged
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
7 changes: 3 additions & 4 deletions apps/user/templates/arbiter-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ export class ArbiterTemplate {

async getArbiterTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, issuedBy];
return [name];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -75,7 +74,7 @@ export class ArbiterTemplate {

<span >
<p style="font-size: 16px; " >has served as an Arbiter at the
<span style="font-size: 16px; font-weight: bold;">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/participant-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ export class ParticipantTemplate {
async getParticipantTemplate(attributes: Attribute[]): Promise<string> {

try {
const [name, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, issuedBy];
return [name];
});

return `<!DOCTYPE html>
Expand Down Expand Up @@ -76,7 +75,7 @@ export class ParticipantTemplate {
margin: 15px;">${name}</p>

<span style="font-size: 16px;">for successfully participating in the
<span style="font-size: 16px; font-weight: bold; ">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold; ">IAM World Memory Championship 2023.</span>
</p>
<p>
<p style="font-size: 14px; margin: 0;">We acknowledge your dedication, hard work, and</p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/winner-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ export class WinnerTemplate {

async getWinnerTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, position, discipline, issuedBy, category] = await Promise.all(attributes).then((attributes) => {
const [name, position, discipline, category] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const position = this.findAttributeByName(attributes, 'position')?.position ?? '';
const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
const category = this.findAttributeByName(attributes, 'category')?.category ?? '';
const date = this.findAttributeByName(attributes, 'issued_date')?.issued_date ?? '';
return [name, position, discipline, issuedBy, category, date];
return [name, position, discipline, category, date];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -79,7 +78,7 @@ export class WinnerTemplate {
<p style="font-size: 16px; margin: 0;">has secured ${position} position for ${discipline} </p>
<p style="font-size: 16px; margin: 6px;">in ${category} category at the</p>
<p style="font-size: 16px;" >
<span style="font-size: 16px; font-weight: bold;"> ${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/world-record-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ export class WorldRecordTemplate {

async getWorldRecordTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, discipline, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name, discipline] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, discipline, issuedBy];
return [name, discipline];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -77,7 +76,7 @@ export class WorldRecordTemplate {
<span style="font-size: 16px;">for successfully creating the world record in the
${discipline}
<p style="font-size: 16px; " >discipline during the
<span style="font-size: 16px; font-weight: bold;">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down
Loading