Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Add the old plugins for reference
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Jul 30, 2022
1 parent 3afd7b6 commit 645fae2
Show file tree
Hide file tree
Showing 26 changed files with 368 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins.old/bookmarksSettingRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import BookmarksState from '~/components/bookmarks/bulma/components/settings/BookmarksState.vue';

Vue.component('setting-bookmarks-state', BookmarksState);

export default ({ store }, inject) => {
store.commit('layout/settings/registerItem', {component: 'setting-bookmarks-state', order: 500})
}
13 changes: 13 additions & 0 deletions plugins.old/bootEnums.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Enum from '@enso-ui/enums'

export default (context, inject) => {
inject('bootEnums', (enums, i18n) => {
const obj = {}

Object.keys(enums).forEach(
(enumName) => (obj[enumName] = new Enum(enums[enumName], i18n))
)

return obj
})
}
9 changes: 9 additions & 0 deletions plugins.old/date-fns/format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import format from '@enso-ui/date/src/format.js';

export default ({ store }, inject) => {
inject('format', (date, formatStr = null) => format(
date,
formatStr || store.state.meta.dateFormat,
store.state.preferences.global.lang,
))
}
5 changes: 5 additions & 0 deletions plugins.old/date-fns/formatDistance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import formatDistance from '@enso-ui/date/src/formatDistance.js';

export default ({ store }, inject) => {
inject('formatDistance', date => formatDistance(date, store.state.preferences.global.lang))
}
16 changes: 16 additions & 0 deletions plugins.old/date-fns/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ro from 'date-fns/esm/locale/ro';
import en from 'date-fns/esm/locale/en-US/';
import de from 'date-fns/esm/locale/de';
import nl from 'date-fns/esm/locale/nl';
import fr from 'date-fns/esm/locale/fr';
import pt from 'date-fns/esm/locale/pt';
// import ar from 'date-fns/esm/locale/ar';
// import mn from 'date-fns/esm/locale/mn';
import hu from 'date-fns/esm/locale/hu';
import es from 'date-fns/esm/locale/es';

const i18n = {
ro, en, de, nl, fr, br: pt, ar: en, mn: en, hu, es
};

export default i18n;
37 changes: 37 additions & 0 deletions plugins.old/date-fns/unicode2php.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const map = [
{ replace: 'Y', with: 'yyyy' }, // 1999
{ replace: 'y', with: 'yy' }, // 99
{ replace: 'Y', with: 'y' }, // 1999
{ replace: 'F', with: 'MMMM' }, // January
{ replace: 'M', with: 'MMM' }, // Jan
{ replace: 'm', with: 'MM' }, // 01
{ replace: 'd', with: 'dd' }, // 19
{ replace: 'j', with: 'd' }, //
{ replace: 'l', with: 'EEEE' }, // Tuesday
{ replace: 'D', with: 'EEE' }, // Tue
{ replace: 'D', with: 'EE' }, // Tue
{ replace: 'a', with: 'a' }, // Am/PM
{ replace: 'p', with: 'p' }, // Am/PM
{ replace: 'H', with: 'HH' }, // 24-hour with leading zeros
{ replace: 'G', with: 'H' }, // 24-hour without leading zeros
{ replace: 'h', with: 'h' }, // 12-hour with leading zeros
{ replace: 'g', with: 'K' }, // 12-hour without leading zero
{ replace: 'i', with: 'mm' }, // Minutes with leading zeros
{ replace: 's', with: 'ss' }, // Seconds, with leading zeros
{ replace: 'T', with: 'zz' }, // Timezone abbreviation
{ replace: 'e', with: 'zzzz' }, // Timezone
];


const segments = formatStr => formatStr
.split(new RegExp([' ', '-', '/', ':', ',', '[.]'].join('|'), ''))
.sort((a, b) => b.length - a.length); // ASC -> a - b; DESC -> b - a

const mapping = segment => map
.find(({ replace }) => replace === segment).with;

const unicode2PHP = formatStr => segments(formatStr)
.reduce((string, segment) => string
.replace(segment, mapping(segment)) || '', formatStr);

export default unicode2PHP;
11 changes: 11 additions & 0 deletions plugins.old/echo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
window.io = require('socket.io-client')
import Echo from 'laravel-echo'

export default ({ app, env }, inject) => {
const echo = new Echo({
broadcaster: 'socket.io',
host: `http://localhost:3000`,
})

inject('echo', echo)
}
31 changes: 31 additions & 0 deletions plugins.old/filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const SI = ['', 'k', 'M', 'G', 'T', 'P', 'E'];
export default ({ store }, inject) => {
Vue.filter('numberFormat', (value, decimals = 3) => new Intl.NumberFormat(
store.state.preferences.global.lang, {
style: 'decimal',
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
},
).format(value));

Vue.filter('shortNumber', (number, precision = 2) => {
number = Number.parseFloat(number);

if (number < 1) {
return number;
}

const tier = Math.floor(Math.log10(number) / 3);

if (tier === 0) {
return number;
}

const suffix = SI[tier];
const scale = 10 ** (tier * 3);
const scaled = number / scale;
const formatted = Number(scaled.toFixed(precision)) + suffix;

return formatted;
});
}
58 changes: 58 additions & 0 deletions plugins.old/fontawesome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon, FontAwesomeLayers, FontAwesomeLayersText } from '@fortawesome/vue-fontawesome';
import {
faListAlt,
faUpload,
faShoePrints,
faPuzzlePiece,
faCalendarAlt,
faFolderOpen,
faVideo,
faUsersCog,
faBook,
faUsers,
faUniversalAccess,
faExclamationTriangle,
faUserTie,
faTerminal,
faLanguage,
faUser,
faBuilding,
faCloudUploadAlt,
faTasks,
faTachometerAlt,
faSlidersH,
faList
} from '@fortawesome/free-solid-svg-icons';
import { faGithub, faGoogle } from '@fortawesome/free-brands-svg-icons';

library.add(
faListAlt,
faGithub,
faUpload,
faShoePrints,
faGoogle,
faPuzzlePiece,
faCalendarAlt,
faFolderOpen,
faVideo,
faUsersCog,
faBook,
faUsers,
faUniversalAccess,
faExclamationTriangle,
faUserTie,
faTerminal,
faLanguage,
faUser,
faBuilding,
faCloudUploadAlt,
faTasks,
faTachometerAlt,
faSlidersH,
faList
);

Vue.component('fa', FontAwesomeIcon);
Vue.component('fal', FontAwesomeLayers);
Vue.component('falt', FontAwesomeLayersText);
39 changes: 39 additions & 0 deletions plugins.old/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export default ({ store }, inject) => {
inject('i18n', (key, params = null) => {
if (key === null || key === '' || typeof key === 'undefined') {
return null
}

if (!store.getters['localisation/ready']) {
return key
}

let translation = store.getters['localisation/i18n'](key)

if (typeof translation === 'undefined' || translation === null) {
translation = key

if (store.state.localisation.keyCollector) {
store.commit('localisation/addMissingKey', key)
}
}

return !!params && typeof params === 'object'
? translation.replace(/:(\w*)/g, (e, key) => {
if (typeof params[key.toLowerCase()] === 'undefined') {
return key
}

const param = params[key.toLowerCase()]

if (key === key.toUpperCase()) {
return param.toUpperCase()
}

return key[0] === key[0].toUpperCase()
? param.charAt(0).toUpperCase() + param.slice(1)
: param
})
: translation || key
})
}
8 changes: 8 additions & 0 deletions plugins.old/ioRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import IO from '~/components/io/bulma/components/navbar/IO.vue';


Vue.component('navbar-io', IO);

export default ({ store }, inject) => {
store.commit('layout/navbar/registerItem', { component: 'navbar-io', order: 200, permission: undefined });
}
13 changes: 13 additions & 0 deletions plugins.old/localisationRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import MissingKey from '~/components/localisation/bulma/components/navbar/MissingKeys.vue';
import KeyCollector from '~/components/localisation/bulma/components/settings/KeyCollector.vue';
import LanguageSelector from '~/components/localisation/bulma/components/settings/LanguageSelector.vue';

Vue.component('navbar-missing-key', MissingKey);
Vue.component('setting-key-collector', KeyCollector);
Vue.component('setting-language-selector', LanguageSelector);

export default ({ store }, inject) => {
store.commit('layout/settings/registerItem', { component: 'setting-language-selector', order: 100 })
store.commit('layout/settings/registerItem', { component: 'setting-key-collector', order: 600 })
store.commit('layout/navbar/registerItem', { component: 'navbar-missing-key', order: 100, permission: undefined });
}
10 changes: 10 additions & 0 deletions plugins.old/notificationsRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Notification from '~/components/notifications/bulma/components/navbar/Notifications.vue';
import ToastPosition from '~/components/notifications/bulma/components/settings/ToastrPosition.vue';

Vue.component('navbar-notification', Notification);
Vue.component('setting-toaster-position', ToastPosition);

export default ({ store }, inject) => {
store.commit('layout/settings/registerItem', { component: 'setting-toaster-position', order: 300 })
store.commit('layout/navbar/registerItem', { component: 'navbar-notification', order: 300, permission: 'core.notifications.count' });
}
9 changes: 9 additions & 0 deletions plugins.old/numberFormat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default ({ store }, inject) => {
inject('numberFormat', (value, decimals = 3) => new Intl.NumberFormat(
store.state.preferences.global.lang, {
style: 'decimal',
minimumFractionDigits: decimals,
maximumFractionDigits: decimals,
},
).format(value))
}
9 changes: 9 additions & 0 deletions plugins.old/pRoute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import RouteMapper from '@enso-ui/route-mapper'

export default ({ store }, inject) => {
inject('pRoute', (name, params, absolute) => {
const { meta, routes } = store.state

return new RouteMapper(meta.appUrl, routes).get(name, params, absolute)
})
}
22 changes: 22 additions & 0 deletions plugins.old/shortNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default (context, inject) => {
inject('shortNumber', (number, precision = 2) => {
number = Number.parseFloat(number);

if (number < 1) {
return number;
}

const tier = Math.floor(Math.log10(number) / 3);

if (tier === 0) {
return number;
}

const suffix = SI[tier];
const scale = 10 ** (tier * 3);
const scaled = number / scale;
const formatted = Number(scaled.toFixed(precision)) + suffix;

return formatted;
});
}
7 changes: 7 additions & 0 deletions plugins.old/tasksNavbarRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Tasks from '~/components/tasks/bulma/components/navbar/Tasks.vue';

Vue.component('navbar-tasks', Tasks);

export default ({ store }, inject) => {
store.commit('layout/navbar/registerItem', { component: 'navbar-tasks', order: 150, permission: 'tasks.count' });
}
7 changes: 7 additions & 0 deletions plugins.old/themesSettingRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ThemeSelector from '~/components/themes/bulma/components/settings/ThemeSelector.vue';

Vue.component('setting-theme-selector', ThemeSelector);

export default ({ store }, inject) => {
store.commit('layout/settings/registerItem', {component: 'setting-theme-selector', order: 200})
}
3 changes: 3 additions & 0 deletions plugins.old/toastr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import toastr from '@enso-ui/toastr';

Vue.prototype.$toastr = toastr;
8 changes: 8 additions & 0 deletions plugins.old/tutorialSettingRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//import Vue from 'vue';
//import Tutorial from '~/components/tutorials/bulma/components/settings/Tutorial.vue';

//Vue.component('setting-tutorials', Tutorial);
//
//export default ({ store }, inject) => {
// store.commit('layout/settings/registerItem', { component: 'setting-tutorials', order: 350 })
//}
7 changes: 7 additions & 0 deletions plugins.old/usersRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ProfileController from '~/components/users/bulma/components/navbar/ProfileControl.vue';

Vue.component('navbar-profile-controller', ProfileController);

export default ({ store }, inject) => {
store.commit('layout/navbar/registerItem', { component: 'navbar-profile-controller', order: 400, permission: undefined });
}
7 changes: 7 additions & 0 deletions plugins.old/vue-fb-customer-chat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import VueFbCustomerChat from 'vue-fb-customer-chat'

Vue.use(VueFbCustomerChat, {
page_id: 2089062604669120, // change 'null' to your Facebook Page ID,
theme_color: '#333333', // theme color in HEX
locale: 'en_US', // default 'en_US'
})
14 changes: 14 additions & 0 deletions plugins.old/vue-gtag.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineNuxtPlugin } from '#app'
import VueGtag from 'vue-gtag-next'

export default defineNuxtPlugin((nuxtApp) => {
const getGDPR = localStorage.getItem('GDPR:accepted');
nuxtApp.vueApp.use(VueGtag, {
property: {
id: 'UA-208194369-1'
},
appName: 'Family Tree 365',
enabled: getGDPR === 'true',
pageTrackerScreenviewEnabled: true
}, nuxtApp.vueApp.router);
});
3 changes: 3 additions & 0 deletions plugins.old/vue-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import vSelect from 'vue-select'
import 'vue-select/dist/vue-select.css'
Vue.component('vue-select', vSelect)
5 changes: 5 additions & 0 deletions plugins.old/vue-stripe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { StripeCheckout } from '@vue-stripe/vue-stripe';

export default () => {
Vue.component('StripeCheckout', StripeCheckout);
};
10 changes: 10 additions & 0 deletions plugins.old/vuetify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// src/plugins/vuetify.js

import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'

Vue.use(Vuetify)

const opts = {}

export default new Vuetify(opts)

0 comments on commit 645fae2

Please sign in to comment.