From c362f32b8fc9ac927cbb75ecf0b9caa2818f650b Mon Sep 17 00:00:00 2001 From: "rothwell.andy@gmail.com" Date: Thu, 16 Jan 2025 12:00:16 -0500 Subject: [PATCH] uses pinboard 2.1.6 --- package-lock.json | 8 +-- package.json | 2 +- src/assets/mac-style.scss | 10 ++++ src/main.js | 4 ++ src/util/is-mac.js | 3 + src/util/transforms.js | 116 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 src/assets/mac-style.scss create mode 100644 src/util/is-mac.js create mode 100644 src/util/transforms.js diff --git a/package-lock.json b/package-lock.json index 4e1ca41..a31c678 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@fortawesome/free-solid-svg-icons": "^6.7.2", "@fortawesome/pro-regular-svg-icons": "^6.7.2", "@phila/phila-ui-core": "^1.0.15", - "@phila/pinboard": "2.1.5", + "@phila/pinboard": "2.1.6", "unplugin-auto-import": "^0.18.3", "unplugin-vue-router": "^0.10.8" }, @@ -1735,9 +1735,9 @@ } }, "node_modules/@phila/pinboard": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@phila/pinboard/-/pinboard-2.1.5.tgz", - "integrity": "sha512-fnJhcEtQVVtoIC+UTr7YGnxBz1Z6hc72yAGRLR43Q1sR0Y6Tif2fynMrd3ctFlAGf1HZFgwMTnHoQNBiWgjeyA==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@phila/pinboard/-/pinboard-2.1.6.tgz", + "integrity": "sha512-7VElDYEc5mmr9s0YVUNX7o27+0GNY7M/1yjMwnIctdOwahnmN88DpAUk3euvSWSz0eK4pioP6noZHp4iXoWeVg==", "dependencies": { "@creativebulma/bulma-tooltip": "^1.2.0", "@fortawesome/fontawesome-pro": "6.7.2", diff --git a/package.json b/package.json index c500a7d..42fadfc 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@fortawesome/free-solid-svg-icons": "^6.7.2", "@fortawesome/pro-regular-svg-icons": "^6.7.2", "@phila/phila-ui-core": "^1.0.15", - "@phila/pinboard": "2.1.5", + "@phila/pinboard": "2.1.6", "unplugin-auto-import": "^0.18.3", "unplugin-vue-router": "^0.10.8" }, diff --git a/src/assets/mac-style.scss b/src/assets/mac-style.scss new file mode 100644 index 0000000..23ef01f --- /dev/null +++ b/src/assets/mac-style.scss @@ -0,0 +1,10 @@ + +::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; +} +::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0,0,0,.5); + box-shadow: 0 0 1px rgba(255,255,255,.5); +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index f5eb8ae..e6026f6 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,10 @@ // (we might not need to use axios with new vue async tools) // if that is not needed, we can move this info to main.js +import isMac from './util/is-mac'; +if (isMac()) { + import('./assets/mac-style.scss') +} // Font Awesome Icons import { library } from '@fortawesome/fontawesome-svg-core'; diff --git a/src/util/is-mac.js b/src/util/is-mac.js new file mode 100644 index 0000000..6d185e8 --- /dev/null +++ b/src/util/is-mac.js @@ -0,0 +1,3 @@ +export default function () { + return /Macintosh/.test(navigator.userAgent); +} \ No newline at end of file diff --git a/src/util/transforms.js b/src/util/transforms.js new file mode 100644 index 0000000..2edc9e2 --- /dev/null +++ b/src/util/transforms.js @@ -0,0 +1,116 @@ +import { format, parseISO } from 'date-fns'; + +export default { + date: { + transform: function (value) { + let valueTransformed; + // console.log('date transform running, value:', value, 'typeof value:', typeof value); + if (typeof value === 'string') { + valueTransformed = format(parseISO(value), 'MM/dd/yyyy'); + } else { + valueTransformed = format(value, 'MM/dd/yyyy'); + } + return valueTransformed; + }, + }, + toLocaleDateString: { + transform: function(epoch){ + // console.log('toLocaleDateString transform, epoch:', epoch, typeof epoch); + let value; + if (typeof epoch !== 'number') { + value = epoch; + } else { + let utcDate = new Date(0); + utcDate.setUTCMilliseconds(epoch); + utcDate = new Date(utcDate.getTime() + utcDate.getTimezoneOffset() * 60000); + value = utcDate.toLocaleDateString(); + } + return value; + }, + }, + titleCase: { + transform: function(str) { + let titleCaseFix = { + Llc: "LLC", + Iii: "III", + Lp: "LP", + Usa: "USA", + Trs: "TRS", + "H/w": "H/W", + Of: "of", + Fdr: "FDR", + "S/w": "S/W", + Mcclellan: "McClellan", + "S/m": "S/M", + And: "and", + Cp: "CP", + Us: "US", + Ltd: "LTD", + Al: 'AL', + Ak: 'AK', + Az: 'AZ', + Ar: 'AR', + Ca: 'CA', + Co: 'CO', + Ct: 'CT', + De: 'DE', + Fl: 'FL', + Ga: 'GA', + Hi: 'HI', + Id: 'ID', + Il: 'IL', + In: 'IN', + Ia: 'IA', + Ks: 'KS', + Ky: 'KY', + La: 'LA', + Me: 'ME', + Md: 'MD', + Ma: 'MA', + Mi: 'MI', + Mn: 'MN', + Ms: 'MS', + Mo: 'MO', + Mt: 'MT', + Ne: 'NE', + Nv: 'NV', + Nh: 'NH', + Nj: 'NJ', + Nm: 'NM', + Ny: 'NY', + Nc: 'NC', + Nd: 'ND', + Oh: 'OH', + Ok: 'OK', + Or: 'OR', + Pa: 'PA', + Ri: 'RI', + Sc: 'SC', + Sd: 'SD', + Tn: 'TN', + Tx: 'TX', + Ut: 'UT', + Vt: 'VT', + Va: 'VA', + Wa: 'WA', + Wv: 'WV', + Wi: 'WI', + Wy: 'WY', + }; + + let fixit = function(str) { + for (let oldCase in titleCaseFix) { + let newCase = titleCaseFix[oldCase]; + } + return str; + }; + + str = str.toLowerCase().split(' ').map(function(word) { + let wordFormatted = word.charAt(0).toUpperCase() + word.slice(1); + wordFormatted = titleCaseFix[wordFormatted] || wordFormatted; + return wordFormatted; + }); + return str.join(' '); + }, + }, +};