Skip to content

Commit

Permalink
udpate format card
Browse files Browse the repository at this point in the history
  • Loading branch information
khanh1902 committed Jun 25, 2024
1 parent d57d768 commit 7a769bc
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions utils/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ module.exports = class Cards {

subtitle =
this.currentLanguage !== this.defaultLanguage
? await translate(
subtitle,
this.currentLanguage,
this.defaultLanguage
)
? await translate(subtitle, this.currentLanguage, this.defaultLanguage)
: subtitle;

const card = {
Expand Down Expand Up @@ -137,12 +133,8 @@ module.exports = class Cards {
if (!value || !type || !label) throw new Error('Missing parameter');

const translateLabel =
currentLanguage !== defaultLanguage
? await translate(
label,
this.currentLanguage,
this.defaultLanguage
).slice(0, 20)
this.currentLanguage !== this.defaultLanguage
? await translate(label, this.currentLanguage, this.defaultLanguage).slice(0, 20)
: label.slice(0, 20);

switch (type) {
Expand Down Expand Up @@ -184,11 +176,7 @@ module.exports = class Cards {

subtitle =
this.currentLanguage !== this.defaultLanguage
? await translate(
subtitle,
this.currentLanguage,
this.defaultLanguage
)
? await translate(subtitle, this.currentLanguage, this.defaultLanguage)
: subtitle;

const card = {
Expand All @@ -208,7 +196,7 @@ module.exports = class Cards {
return result.slice(0, 10);
}

async formatLINEButtons(buttonse) {
async formatLINEButtons(buttons) {
let result = [];
if (!Array.isArray(buttons) || !buttons.length) return result;

Expand All @@ -219,12 +207,8 @@ module.exports = class Cards {
if (!value || !type || !label) throw new Error('Missing parameter');

const translateLabel =
currentLanguage !== defaultLanguage
? await translate(
label,
this.currentLanguage,
this.defaultLanguage
).slice(0, 20)
this.currentLanguage !== this.defaultLanguage
? await translate(label, this.currentLanguage, this.defaultLanguage).slice(0, 20)
: label.slice(0, 20);

switch (type) {
Expand Down

0 comments on commit 7a769bc

Please sign in to comment.