Skip to content

Commit

Permalink
feature(postman_tests_scripts): reinstore css vars, add try catch to …
Browse files Browse the repository at this point in the history
…postmanTranslation function
  • Loading branch information
bpoulaindev committed Feb 28, 2024
1 parent 1a79dd9 commit a79cef9
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 84 deletions.
138 changes: 65 additions & 73 deletions packages/bruno-app/src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,76 +1,68 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;

--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;

--primary: 240 5.9% 10%;
--primary-foreground: 0 0% 98%;

--secondary: 240 4.8% 95.9%;
--secondary-foreground: 240 5.9% 10%;

--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;

--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
:root {
--color-brand: #546de5;
--color-text: rgb(52 52 52);
--color-sidebar-collection-item-active-indent-border: #d0d0d0;
--color-sidebar-background: #f3f3f3;
--color-request-dragbar-background: #efefef;
--color-request-dragbar-background-active: rgb(200, 200, 200);
--color-tab-inactive: rgb(155 155 155);
--color-tab-active-border: #546de5;
--color-layout-border: #dedede;
--color-text-link: #1663bb;
--color-text-danger: rgb(185, 28, 28);
--color-background-danger: #dc3545;
--color-method-get: rgb(5, 150, 105);
--color-method-post: #8e44ad;
--color-method-put: #ca7811;
--color-method-delete: rgb(185, 28, 28);
--color-method-patch: rgb(52 52 52);
--color-method-options: rgb(52 52 52);
--color-method-head: rgb(52 52 52);
}

html,
body {
margin: 0;
padding: 0;
font-size: 1rem;
color: rgb(52 52 52);

font-kerning: none;
text-rendering: optimizeSpeed;
letter-spacing: normal;
font-family: Inter, sans-serif !important;
overflow-x: hidden;
}

body {
font-size: 0.875rem;
}

--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
--ring: 240 10% 3.9%;

--radius: 0.5rem;
}

.dark {
--background: 240 10% 3.9%;
--foreground: 0 0% 98%;

--card: 240 10% 3.9%;
--card-foreground: 0 0% 98%;

--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;

--primary: 0 0% 98%;
--primary-foreground: 240 5.9% 10%;

--secondary: 240 3.7% 15.9%;
--secondary-foreground: 0 0% 98%;

--muted: 240 3.7% 15.9%;
--muted-foreground: 240 5% 64.9%;

--accent: 240 3.7% 15.9%;
--accent-foreground: 0 0% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;

--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;
}
body::-webkit-scrollbar,
.CodeMirror-vscrollbar::-webkit-scrollbar {
width: 0.6rem;
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

body::-webkit-scrollbar-track,
.CodeMirror-vscrollbar::-webkit-scrollbar-track {
background-color: #f1f1f1;
}

body::-webkit-scrollbar-thumb,
.CodeMirror-vscrollbar::-webkit-scrollbar-thumb {
background-color: #cdcdcd;
border-radius: 5rem;
}

/*
* todo: this will be supported in the future to be changed via applying a theme
* making all the checkboxes and radios bigger
* input[type='checkbox'],
* input[type='radio'] {
* transform: scale(1.1);
* }
*/
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ const replacements = {
};

export const postmanTranslation = (script) => {
const modifiedScript = Object.entries(replacements)
.map(([pattern, replacement]) => {
const regex = new RegExp(pattern, 'g');
return script.replace(regex, replacement);
})
.find((modified) => modified !== script);
if (modifiedScript) {
// translation successful
return modifiedScript;
} else {
try {
const modifiedScript = Object.entries(replacements || {})
.map(([pattern, replacement]) => {
const regex = new RegExp(pattern, 'g');
return script?.replace(regex, replacement);
})
.find((modified) => modified !== script);
if (modifiedScript) {
// translation successful
return modifiedScript;
} else {
// non-translatable script
return script?.includes('pm.') ? `// ${script}` : script;
}
} catch (e) {
// non-translatable script
return script.includes('pm.') ? `// ${script}` : script;
return script?.includes('pm.') ? `// ${script}` : script;
}
};

0 comments on commit a79cef9

Please sign in to comment.