Skip to content

Commit

Permalink
Merge branch 'develop' into feature/uvf
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed May 17, 2024
2 parents aad13fa + fd51860 commit 686713b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
61 changes: 32 additions & 29 deletions frontend/src/common/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,35 +262,7 @@ class AuthorityService {
pictureUrl: authority.pictureUrl
}
} else {
let cfg: JdenticonConfig;
switch (authority.type) {
case 'USER':
cfg = {
hues: [6, 28, 48, 121, 283],
saturation: {
color: 0.59,
},
lightness: {
color: [0.32, 0.49],
grayscale: [0.32, 0.49]
},
backColor: '#F7F7F7',
padding: 0
};
case 'GROUP':
cfg = {
hues: [190],
saturation: {
color: 0.59
},
lightness: {
color: [0.81, 0.97],
grayscale: [0.81, 0.97]
},
backColor: '#005E71',
padding: 0
};
}
let cfg = AuthorityService.getJdenticonConfig(authority.type);
const svg = toSvg(authority.id, 100, cfg);
const bytes = new TextEncoder().encode(svg);
const url = `data:image/svg+xml;base64,${base64.stringify(bytes)}`;
Expand All @@ -300,6 +272,37 @@ class AuthorityService {
};
}
}

private static getJdenticonConfig(type: 'USER' | 'GROUP'): JdenticonConfig {
switch (type) {
case 'USER':
return {
hues: [6, 28, 48, 121, 283],
saturation: {
color: 0.59,
},
lightness: {
color: [0.32, 0.49],
grayscale: [0.32, 0.49]
},
backColor: '#F7F7F7',
padding: 0
};
case 'GROUP':
return {
hues: [190],
saturation: {
color: 0.59
},
lightness: {
color: [0.81, 0.97],
grayscale: [0.81, 0.97]
},
backColor: '#005E71',
padding: 0
};
}
}
}

class BillingService {
Expand Down
1 change: 1 addition & 0 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"noUnusedLocals": false,
"noFallthroughCasesInSwitch": true,
"useUnknownInCatchVariables": false, // Workaround for `node_modules/miscreant/src/providers/webcrypto.ts:21:11 - error TS18046: 'e' is of type 'unknown'.`
},
"ts-node": {
Expand Down

0 comments on commit 686713b

Please sign in to comment.