Skip to content

Commit

Permalink
UJ: Merged from template.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwieds committed May 22, 2024
2 parents 3ce8d66 + a145107 commit 271cdc3
Show file tree
Hide file tree
Showing 8 changed files with 400 additions and 73 deletions.
192 changes: 192 additions & 0 deletions _includes/master/assets/css/defaults.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,195 @@ footer, header, hgroup, menu, nav, section {
-o-transition: all .3s cubic-bezier(.2,.3,0,1);
transition: all .3s cubic-bezier(.2,.3,0,1);
}

/* @keyframes opacity {
0% {
opacity: 0;
}
to {
opacity: 1;
}
}
.animation-opacity {
animation: opacity .25s ease-in-out;
}
@keyframes opacity-long {
0% {
opacity: 0;
}
90% {
opacity: 0;
}
to {
opacity: 1;
}
}
.animation-opacity-long {
animation: opacity-long 3s ease-in-out;
}
@keyframes opacity-short {
0% {
opacity: 0;
}
80% {
opacity: 0;
}
to {
opacity: 1;
}
}
.animation-opacity-short {
animation: opacity-short 1.5s ease-in-out;
} */

@keyframes popup {
0% {
transform: scale(.93);
opacity: .8;
}

50% {
transform: scale(1.02);
opacity: 1;
}

to {
transform: scale(1);
opacity: 1;
}
}

.animation-popup {
animation: popup .25s ease-in-out;
}

@keyframes popup-long {
0% {
transform: scale(.93);
opacity: 0;
}

85% {
transform: scale(.93);
opacity: 0;
}

90% {
transform: scale(.93);
opacity: .8;
}

95% {
transform: scale(1.02);
opacity: 1;
}

to {
transform: scale(1);
opacity: 1;
}
}

.animation-popup-long {
animation: popup-long 3s ease-in-out
}

@keyframes popup-short {
0% {
transform: scale(.93);
opacity: 0;
}

75% {
transform: scale(.93);
opacity: 0;
}

80% {
transform: scale(.93);
opacity: .8;
}

90% {
transform: scale(1.02);
opacity: 1;
}

to {
transform: scale(1);
opacity: 1;
}
}

.animation-popup-short {
animation: popup-short 1.5s ease-in-out;
}

@keyframes pulse {
50% {
opacity: .5;
}
}

.animation-pulse {
animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;
}

@keyframes shimmer {
0% {
background-position: 0 50%;
}

50% {
background-position: 100% 50%;
}

to {
background-position: 0 50%;
}
}

.animation-shimmer {
animation: shimmer 3s ease-out infinite alternate;
}

@keyframes wiggle {
0%,
20%,
80%,
to {
transform: rotate(0deg);
}

30%,
60% {
transform: rotate(-2deg);
}

40%,
70% {
transform: rotate(2deg);
}

45% {
transform: rotate(-4deg);
}

55% {
transform: rotate(4deg);
}
}

.animation-wiggle {
animation: wiggle 1.5s ease-in-out infinite;
}
65 changes: 54 additions & 11 deletions _includes/master/modules/user/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ <h4 class="text-white">Error!</h4>
'>
</div>

<div id="dashboard-template-display-ready" data-template='
<div class="toast-container position-fixed p-3 top-0 start-50 translate-middle-x" style="z-index: 1003; _min-width: 50vw;">
<div class="dashboard-status-listener toast bg-primary text-white" data-status="ready">
<div class="d-flex">
<div class="toast-body">
<h4 class="text-white">Alert!</h4>
<span class="dashboard-status-listener-message" data-status="ready">
Unknown ready
</span>
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
'>
</div>

<div id="dashboard-template-unsaved-popup" data-template='
<div class="dashboard-display-unsaved-popup" hidden>
<div class="position-fixed start-50 bottom-0 translate-middle-x w-100 zi-99 mb-3" style="max-width: 40rem;" >
Expand Down Expand Up @@ -97,9 +114,10 @@ <h4 class="text-white">Error!</h4>
self.allowLeave = true;

self._handler = {
transformData: function (data) {return data},
onSubmit: function () {},
onChange: function () {},
transformData: function (data) {return data},
onStatus: function () {},
}
self._triggeredInitialOnChangeEvent = false;
self._$manualChangeTriggerElement = null;
Expand Down Expand Up @@ -139,9 +157,13 @@ <h4 class="text-white">Error!</h4>

// Create default elements
if (options.createDefaultElements) {
self.element.id.get(0).insertAdjacentHTML('beforeend', document.getElementById('dashboard-template-display-error').getAttribute('data-template'));
self.element.id.get(0).insertAdjacentHTML('beforeend', document.getElementById('dashboard-template-display-success').getAttribute('data-template'));
self.element.id.get(0).insertAdjacentHTML('beforeend', document.getElementById('dashboard-template-unsaved-popup').getAttribute('data-template'));
function create(id) {
self.element.id.get(0).insertAdjacentHTML('beforeend', document.getElementById(id).getAttribute('data-template'));
}
create('dashboard-template-display-success');
create('dashboard-template-display-error');
create('dashboard-template-display-ready');
create('dashboard-template-unsaved-popup');
}

// Setup the rest of the elements
Expand Down Expand Up @@ -239,6 +261,7 @@ <h4 class="text-white">Error!</h4>
message = message || '';
}

// Set status
self.status = status;

console.log('[Dashboard] display', self.id, 'status=', status, 'state=', state, 'message=', message);
Expand Down Expand Up @@ -282,21 +305,30 @@ <h4 class="text-white">Error!</h4>
.each(function ($el) {
var s = $el.getAttribute('data-status');

// If we are in the correct status
if (s === status) {

// Show the element
$el.removeAttribute('hidden');

// If no message, quit because we don't want to show empty feedback
if (!message) { return }

// Set the status message
$statusMessage
.each(function ($el) {
$el.innerHTML = message;
})

// Attempt to show a toast
try {
var toast = new bootstrap.Toast($el, {autohide: false})
toast.show();
} catch (e) {
// console.warn('[Dashboard] Unable to create error toast', e);
}

$statusMessage
.each(function ($el) {
$el.innerHTML = message;
})
} else {
// Hide the element
$el.setAttribute('hidden', true);
}
})
Expand Down Expand Up @@ -330,6 +362,9 @@ <h4 class="text-white">Error!</h4>
}
}

// Run onStatus
self._handler.onStatus(status, message);

return self;
};

Expand Down Expand Up @@ -411,6 +446,14 @@ <h4 class="text-white">Error!</h4>
return self;
};

Dashboard.prototype.onChange = function (fn) {
var self = this;

self._handler.onChange = fn;

return self;
};

Dashboard.prototype.onSubmit = function (fn) {
var self = this;

Expand All @@ -419,10 +462,10 @@ <h4 class="text-white">Error!</h4>
return self;
};

Dashboard.prototype.onChange = function (fn) {
Dashboard.prototype.onStatus = function (fn) {
var self = this;

self._handler.onChange = fn;
self._handler.onStatus = fn;

return self;
};
Expand Down
23 changes: 13 additions & 10 deletions _websrc/gulp_tasks/master/_prefill.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ gulp.task('_prefill', () => {

// only create these files if NOT on template
if (!tools.isTemplate) {

await createFile(`.vscode/settings.json`, await readFile('./_websrc/templates/master/vscode/settings.json'));
}

// only create these files if IS ON template and IS NOT server
Expand Down Expand Up @@ -254,25 +254,28 @@ function generateCommonModules() {
return contents;
}

async function createFile(file, contents) {
async function createFile(file, contents, options) {
const response = {
exists: false,
error: null,
}

options = options || {};
options.overwrite = typeof options.overwrite === 'undefined' ? false : options.overwrite;

return new Promise(function(resolve, reject) {
try {
if (jetpack.exists(file)) {
response.exists = true;
// Check if file exists
response.exists = jetpack.exists(file);

// If file exists and force is not true, resolve
if (response.exists && !options.overwrite) {
resolve(response)
} else {
jetpack.write(file, contents);
response.exists = false;
resolve(response);
jetpack.write(file, contents);
resolve(response);
}
} catch (e) {
response.error = e;
reject(response);
reject(e);
}
});
}
Expand Down
8 changes: 8 additions & 0 deletions _websrc/templates/master/vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Workspace settings
{
// The following will hide certian files from the file explorer
"files.exclude": {
// Hide any files with /master/ in the path
"**/master/**": true,
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Ultimate Jekyll starter project including full setup for gulp, Sass, Autoprefixer, PostCSS, webpack, imagemin, Browsersync etc.",
"main": "index.js",
"scripts": {
"preinstall": "bundle update && bundle install",
"preinstall": "bundle install && bundle update",
"start": "npm run _start -- --skipImageMin='true' --skipESLint='true' --skipJSMin='true'",
"_start": "bundle exec gulp clean:jekyll && bundle exec gulp",
"dist": "git add . && git commit -m 'Published pages' && git push origin",
Expand Down
Loading

0 comments on commit 271cdc3

Please sign in to comment.