Skip to content

Commit

Permalink
chore: update icons unicode
Browse files Browse the repository at this point in the history
colored-viber was manually switched for a different id
this should not have any impact on users

This change was requested by mobile team, because unicode chars need to be unique
  • Loading branch information
DSil committed Aug 30, 2024
1 parent 9035430 commit bb5f141
Show file tree
Hide file tree
Showing 326 changed files with 1,153 additions and 1,152 deletions.
23 changes: 12 additions & 11 deletions packages/orbit-components/config/fetchIcons.mts
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,29 @@ const parseName = (name: string) => {
const setSvgContent = (name: string, content: string, id: string) => {
if (/colored-/g.test(name) || name === "google") {
return dedent`
<!--character:${id}-->
<!--customColor:true-->
${content}`;
<!--character:${id}-->
<!--customColor:true-->
${content}`;
}

return dedent`
<!--character:${id}-->
${content
.replace(/(fill|clip)-rule="evenodd"|fill=".*"/gm, "")
.replace(/(stroke|stroke-.*)=".*"/gm, "")}
`;
<!--character:${id}-->
${content
.replace(/(fill|clip)-rule="evenodd"|fill=".*"/gm, "")
.replace(/(stroke|stroke-.*)=".*"/gm, "")}
`;
};

async function saveOrbitIcons(data: { name: string; svg: string; id: string }[]) {
const savedIds: string[] = [];

for (const { name, svg, id } of data) {
// id is of format XXXX:XXXX, we want the second part only.
const unicodeId = id.split(":")[1];
const parsedName = parseName(name);
const content = setSvgContent(parsedName, svg, id);
const content = setSvgContent(parsedName, svg, unicodeId);
const filePath = path.join(SVG_FOLDER, `${parsedName}.svg`);
let currentId = id;
let currentId = unicodeId;

if (!fs.existsSync(filePath)) {
await fs.writeFile(filePath, content, "utf-8").then(() => {
Expand All @@ -168,7 +170,6 @@ async function saveOrbitIcons(data: { name: string; svg: string; id: string }[])
height,
{ threshold: 0.1 },
);

// update the content only if the diff is bigger than 0
if (numDiffPixels > 0) {
currentId = match;
Expand Down
12 changes: 6 additions & 6 deletions packages/orbit-components/src/icons/svg/accommodation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/orbit-components/src/icons/svg/account-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions packages/orbit-components/src/icons/svg/admin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/orbit-components/src/icons/svg/ai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bb5f141

Please sign in to comment.