Skip to content

Commit

Permalink
Confetti
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Jun 29, 2024
1 parent ced1094 commit 7eafa1e
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 48 deletions.
11 changes: 9 additions & 2 deletions app/Core/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,11 @@ public function displayNotification(): string

if (session()->exists("confettiInYourFace") && session("confettiInYourFace") === true) {
$notification .= app('blade.compiler')::render(
'<script type="text/javascript">confetti.start();</script>',
'<script type="text/javascript">confetti({
spread: 70,
origin: { y: 1.2 },
});
</script>',
[]
);

Expand Down Expand Up @@ -754,7 +758,10 @@ public function displayInlineNotification(): string

if (session()->exists("confettiInYourFace") && session("confettiInYourFace") === true) {
$notification .= app('blade.compiler')::render(
'<script type="text/javascript">confetti.start();</script>',
'<script type="text/javascript">confetti({
spread: 70,
origin: { y: 1.2 },
});</script>',
[]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ function toggleCommentBoxes(id, formHash) {
}

jQuery(".confetti").click(function(){
confetti.start();
confetti({
spread: 70,
origin: { y: 1.2 },
});
});

function respondToVisibility(element, callback) {
Expand Down
12 changes: 6 additions & 6 deletions app/Domain/Dashboard/Js/dashboardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ leantime.dashboardController = (function () {
label: leantime.i18n.__("label.done_todos"),
backgroundColor: leantime.dashboardController.chartColors.green,
borderColor: leantime.dashboardController.chartColors.green,
data: actualData['done']['data'],
data: actualData.done.data,
fill: true,
lineTension: 0,
pointRadius:0,
Expand All @@ -211,7 +211,7 @@ leantime.dashboardController = (function () {
label: leantime.i18n.__("label.progress_todos"),
backgroundColor: leantime.dashboardController.chartColors.yellow,
borderColor: leantime.dashboardController.chartColors.yellow,
data: actualData['progress']['data'],
data: actualData.progress.data,
fill: true,
lineTension: 0,
pointRadius:0,
Expand All @@ -221,7 +221,7 @@ leantime.dashboardController = (function () {
label: leantime.i18n.__("label.new_todos"),
backgroundColor: leantime.dashboardController.chartColors.red,
borderColor: leantime.dashboardController.chartColors.red,
data: actualData['open']['data'],
data: actualData.open.data,
fill: true,
lineTension: 0,
pointRadius:0,
Expand Down Expand Up @@ -296,10 +296,10 @@ leantime.dashboardController = (function () {
jQuery("#" + id).click(
function (event) {

chart.data.datasets[0].data = actualData['done']['data'];
chart.data.datasets[0].data = actualData.done.data;

chart.data.datasets[1].data = actualData['progress']['data'];
chart.data.datasets[2].data = actualData['open']['data'];
chart.data.datasets[1].data = actualData.progress.data;
chart.data.datasets[2].data = actualData.open.data;


chart.options.scales.y.title.text = label;
Expand Down
28 changes: 14 additions & 14 deletions app/Domain/Gamecenter/Js/game-snake.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,22 @@ SNAKE.Snake = SNAKE.Snake || (function() {

// ----- public variables -----
me.snakeBody = {};
me.snakeBody["b0"] = new SnakeBlock(); // create snake head
me.snakeBody["b0"].row = config.startRow || 1;
me.snakeBody["b0"].col = config.startCol || 1;
me.snakeBody["b0"].xPos = me.snakeBody["b0"].row * playingBoard.getBlockWidth();
me.snakeBody["b0"].yPos = me.snakeBody["b0"].col * playingBoard.getBlockHeight();
me.snakeBody["b0"].elm = createSnakeElement();
me.snakeBody["b0"].elmStyle = me.snakeBody["b0"].elm.style;
playingBoard.getBoardContainer().appendChild( me.snakeBody["b0"].elm );
me.snakeBody["b0"].elm.style.left = me.snakeBody["b0"].xPos + "px";
me.snakeBody["b0"].elm.style.top = me.snakeBody["b0"].yPos + "px";
me.snakeBody["b0"].next = me.snakeBody["b0"];
me.snakeBody["b0"].prev = me.snakeBody["b0"];
me.snakeBody.b0 = new SnakeBlock(); // create snake head
me.snakeBody.b0.row = config.startRow || 1;
me.snakeBody.b0.col = config.startCol || 1;
me.snakeBody.b0.xPos = me.snakeBody.b0.row * playingBoard.getBlockWidth();
me.snakeBody.b0.yPos = me.snakeBody.b0.col * playingBoard.getBlockHeight();
me.snakeBody.b0.elm = createSnakeElement();
me.snakeBody.b0.elmStyle = me.snakeBody.b0.elm.style;
playingBoard.getBoardContainer().appendChild( me.snakeBody.b0.elm );
me.snakeBody.b0.elm.style.left = me.snakeBody.b0.xPos + "px";
me.snakeBody.b0.elm.style.top = me.snakeBody.b0.yPos + "px";
me.snakeBody.b0.next = me.snakeBody.b0;
me.snakeBody.b0.prev = me.snakeBody.b0;

me.snakeLength = 1;
me.snakeHead = me.snakeBody["b0"];
me.snakeTail = me.snakeBody["b0"];
me.snakeHead = me.snakeBody.b0;
me.snakeTail = me.snakeBody.b0;
me.snakeHead.elm.className = me.snakeHead.elm.className.replace(/\bsnake-snakebody-dead\b/,'');
me.snakeHead.elm.id = "snake-snakehead-alive";
me.snakeHead.elm.className += " snake-snakebody-alive";
Expand Down
5 changes: 4 additions & 1 deletion app/Domain/Help/Js/helperController.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ leantime.helperController = (function () {
scrollTo:true,
when: {
show: function() {
confetti.start();
confetti({
spread: 70,
origin: { y: 1.2 },
});
}
},
advanceOn: '.headmenu click'
Expand Down
5 changes: 5 additions & 0 deletions app/Views/Templates/sections/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
<script src="{!! BASE_URL !!}/dist/js/compiled-app.{!! $version !!}.min.js"></script>
@dispatchEvent('afterMainScriptTag')

<!--
//For future file based ref js loading
<script src="{!! BASE_URL !!}/dist/js/{{ ucwords(\Leantime\Core\Frontcontroller::getModuleName()) }}/Js/{{ Leantime\Core\Frontcontroller::getModuleName() }}Controller.js"></script>
-->

<!-- theme & custom -->
@foreach ($themeScripts as $script)
<script src="{!! $script !!}"></script>
Expand Down
14 changes: 12 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@sentry/browser": "^7.109.0",
"@sentry/webpack-plugin": "^2.16.1",
"ajv": "^8.13.0",
"canvas-confetti": "^1.9.3",
"chart.js": "^3.6.0",
"chartjs-adapter-luxon": "^1.3.1",
"chosen-js": "^1.8.7",
Expand All @@ -23,8 +24,8 @@
"datatables.net-rowgroup": "^1.4.1",
"datatables.net-rowreorder": "^1.4.1",
"fullcalendar": "^6.1.11",
"htmx.org": "^1.9.12",
"gridstack": "^10.1.2",
"htmx.org": "^1.9.12",
"ical.js": "^1.5.0",
"imagesloaded": "^5.0.0",
"isotope-layout": "^3.0.6",
Expand Down
8 changes: 5 additions & 3 deletions public/assets/js/libs/confetti/js/confetti.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var confetti = (function () {
let cy = '';

let confetti = [];
const confettiCount = 500;
const gravity = 0.7;
const confettiCount = 50;
const gravity = 1.2;
const terminalVelocity = 5;
const drag = 0.075;
const colors = [
Expand Down Expand Up @@ -85,14 +85,16 @@ var confetti = (function () {

velocity: {
x: randomRange(-25, 25),
y: randomRange(0, -50) } });
y: randomRange(0, -50) }
});

}

};

//---------Render-----------
let render = () => {

ctx.clearRect(0, 0, canvas.width, canvas.height);

confetti.forEach((confetto, index) => {
Expand Down
73 changes: 58 additions & 15 deletions public/dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,62 @@
{
"/js/compiled-htmx.3.1.4.min.js": "/js/compiled-htmx.3.1.4.min.js",
"/js/compiled-htmx-headSupport.3.1.4.min.js": "/js/compiled-htmx-headSupport.3.1.4.min.js",
"/css/main.3.1.4.min.css": "/css/main.3.1.4.min.css",
"/css/editor.3.1.4.min.css": "/css/editor.3.1.4.min.css",
"/css/app.3.1.4.min.css": "/css/app.3.1.4.min.css",
"/js/compiled-footer.3.1.4.min.js": "/js/compiled-footer.3.1.4.min.js",
"/js/compiled-app.3.1.4.min.js": "/js/compiled-app.3.1.4.min.js",
"/js/compiled-frameworks.3.1.4.min.js": "/js/compiled-frameworks.3.1.4.min.js",
"/js/compiled-framework-plugins.3.1.4.min.js": "/js/compiled-framework-plugins.3.1.4.min.js",
"/js/compiled-global-component.3.1.4.min.js": "/js/compiled-global-component.3.1.4.min.js",
"/js/compiled-calendar-component.3.1.4.min.js": "/js/compiled-calendar-component.3.1.4.min.js",
"/js/compiled-table-component.3.1.4.min.js": "/js/compiled-table-component.3.1.4.min.js",
"/js/compiled-editor-component.3.1.4.min.js": "/js/compiled-editor-component.3.1.4.min.js",
"/js/compiled-gantt-component.3.1.4.min.js": "/js/compiled-gantt-component.3.1.4.min.js",
"/js/compiled-chart-component.3.1.4.min.js": "/js/compiled-chart-component.3.1.4.min.js",
"/js/Auth/Js/authController.js": "/js/Auth/Js/authController.js",
"/js/Calendar/Js/calendarController.js": "/js/Calendar/Js/calendarController.js",
"/js/Canvas/Js/canvasController.js": "/js/Canvas/Js/canvasController.js",
"/js/Clients/Js/clientsController.js": "/js/Clients/Js/clientsController.js",
"/js/Comments/Js/commentsController.js": "/js/Comments/Js/commentsController.js",
"/js/Cpcanvas/Js/cpCanvasController.js": "/js/Cpcanvas/Js/cpCanvasController.js",
"/js/Dashboard/Js/dashboardController.js": "/js/Dashboard/Js/dashboardController.js",
"/js/Dbmcanvas/Js/dbmCanvasController.js": "/js/Dbmcanvas/Js/dbmCanvasController.js",
"/js/Eacanvas/Js/eaCanvasController.js": "/js/Eacanvas/Js/eaCanvasController.js",
"/js/Emcanvas/Js/emCanvasController.js": "/js/Emcanvas/Js/emCanvasController.js",
"/js/Gamecenter/Js/game-snake.js": "/js/Gamecenter/Js/game-snake.js",
"/js/Goalcanvas/Js/goalCanvasController.js": "/js/Goalcanvas/Js/goalCanvasController.js",
"/js/Help/Js/helperController.js": "/js/Help/Js/helperController.js",
"/js/Help/Js/helperRepository.js": "/js/Help/Js/helperRepository.js",
"/js/Ideas/Js/ideasController.js": "/js/Ideas/Js/ideasController.js",
"/js/Insightscanvas/Js/insightsCanvasController.js": "/js/Insightscanvas/Js/insightsCanvasController.js",
"/js/Lbmcanvas/Js/lbmCanvasController.js": "/js/Lbmcanvas/Js/lbmCanvasController.js",
"/js/Leancanvas/Js/leanCanvasController.js": "/js/Leancanvas/Js/leanCanvasController.js",
"/js/Menu/Js/menuController.js": "/js/Menu/Js/menuController.js",
"/js/Menu/Js/menuRepository.js": "/js/Menu/Js/menuRepository.js",
"/js/Minempathycanvas/Js/risksCanvasController.js": "/js/Minempathycanvas/Js/risksCanvasController.js",
"/js/Obmcanvas/Js/obmCanvasController.js": "/js/Obmcanvas/Js/obmCanvasController.js",
"/js/Projects/Js/projectsController.js": "/js/Projects/Js/projectsController.js",
"/js/Reactions/Js/reactionsController.js": "/js/Reactions/Js/reactionsController.js",
"/js/Retroscanvas/Js/retroCanvasController.js": "/js/Retroscanvas/Js/retroCanvasController.js",
"/js/Riskscanvas/Js/risksCanvasController.js": "/js/Riskscanvas/Js/risksCanvasController.js",
"/js/Sbcanvas/Js/sbCanvasController.js": "/js/Sbcanvas/Js/sbCanvasController.js",
"/js/Setting/Js/settingController.js": "/js/Setting/Js/settingController.js",
"/js/Setting/Js/settingRepository.js": "/js/Setting/Js/settingRepository.js",
"/js/Setting/Js/settingService.js": "/js/Setting/Js/settingService.js",
"/js/Smcanvas/Js/smCanvasController.js": "/js/Smcanvas/Js/smCanvasController.js",
"/js/Sqcanvas/Js/sqCanvasController.js": "/js/Sqcanvas/Js/sqCanvasController.js",
"/js/Swotcanvas/Js/swotCanvasController.js": "/js/Swotcanvas/Js/swotCanvasController.js",
"/js/Tickets/Js/ticketsController.js": "/js/Tickets/Js/ticketsController.js",
"/js/Tickets/Js/ticketsRepository.js": "/js/Tickets/Js/ticketsRepository.js",
"/js/Timesheets/Js/timesheetsController.js": "/js/Timesheets/Js/timesheetsController.js",
"/js/Users/Js/usersController.js": "/js/Users/Js/usersController.js",
"/js/Users/Js/usersRepository.js": "/js/Users/Js/usersRepository.js",
"/js/Users/Js/usersService.js": "/js/Users/Js/usersService.js",
"/js/Valuecanvas/Js/valueCanvasController.js": "/js/Valuecanvas/Js/valueCanvasController.js",
"/js/Widgets/Js/Widgetcontroller.js": "/js/Widgets/Js/Widgetcontroller.js",
"/js/Wiki/Js/wikiController.js": "/js/Wiki/Js/wikiController.js",
"/js/compiled-htmx.3.2.0-beta.min.js": "/js/compiled-htmx.3.2.0-beta.min.js",
"/js/compiled-htmx-headSupport.3.2.0-beta.min.js": "/js/compiled-htmx-headSupport.3.2.0-beta.min.js",
"/js/authController.js": "/js/authController.js",
"/css/main.3.2.0-beta.min.css": "/css/main.3.2.0-beta.min.css",
"/css/editor.3.2.0-beta.min.css": "/css/editor.3.2.0-beta.min.css",
"/css/app.3.2.0-beta.min.css": "/css/app.3.2.0-beta.min.css",
"/js/compiled-footer.3.2.0-beta.min.js": "/js/compiled-footer.3.2.0-beta.min.js",
"/js/compiled-app.3.2.0-beta.min.js": "/js/compiled-app.3.2.0-beta.min.js",
"/js/compiled-frameworks.3.2.0-beta.min.js": "/js/compiled-frameworks.3.2.0-beta.min.js",
"/js/compiled-framework-plugins.3.2.0-beta.min.js": "/js/compiled-framework-plugins.3.2.0-beta.min.js",
"/js/compiled-global-component.3.2.0-beta.min.js": "/js/compiled-global-component.3.2.0-beta.min.js",
"/js/compiled-calendar-component.3.2.0-beta.min.js": "/js/compiled-calendar-component.3.2.0-beta.min.js",
"/js/compiled-table-component.3.2.0-beta.min.js": "/js/compiled-table-component.3.2.0-beta.min.js",
"/js/compiled-editor-component.3.2.0-beta.min.js": "/js/compiled-editor-component.3.2.0-beta.min.js",
"/js/compiled-gantt-component.3.2.0-beta.min.js": "/js/compiled-gantt-component.3.2.0-beta.min.js",
"/js/compiled-chart-component.3.2.0-beta.min.js": "/js/compiled-chart-component.3.2.0-beta.min.js",
"/images/03-1.png": "/images/03-1.png",
"/images/32px.png": "/images/32px.png",
"/images/40px.png": "/images/40px.png",
Expand Down
44 changes: 41 additions & 3 deletions webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,53 @@ const glob = require('glob');
const path = require('path');
const version = pjson.version;

const fs = require("fs");

// Helper to get all files of a given extension in a given directory and its subfolders.
function getFilesRecursive(dir, type) {
// The list of files that we will return.
let files = []
// Loop everything in given location.
fs.readdirSync(dir).forEach(file => {
let fileName = `${dir}/${file}`
// Add if its a file and it is of the correct file type.
if(fs.statSync(fileName).isFile() && fileName.endsWith(type)) {
files.push(fileName)
}
// Process subfolder.
if(!fs.statSync(fileName).isFile()) {
// Recusively loop this function for the subfolder.
files = files.concat(getFilesRecursive(fileName, type))
}
})
return files
}



let mix = require('laravel-mix');
require('laravel-mix-eslint');
require('mix-tailwindcss');

require('dotenv').config({ path: 'config/.env' });

mix
.setPublicPath('public/dist') // this is the URL to place assets referenced in the CSS/JS
.setResourceRoot(`../`) // this is what to prefix the URL with
.setPublicPath('public/dist')
.setResourceRoot(`../`);

/*
//Draft for file based js controller loading
getFilesRecursive('app/Domain', '.js').forEach(file => {
subfolder = file.match(/(.*)[\/\\]/)[1]||''; // 'src/js/libraries'
subfolder = subfolder.replace('app/Domain', ''); // '/libraries'
mix.js(file, 'js' + subfolder);
});
*/


// this is the URL to place assets referenced in the CSS/JS
mix // this is what to prefix the URL with
.combine('./public/assets/js/libs/prism/prism.js', `public/dist/js/compiled-footer.${version}.min.js`)
.js('./public/assets/js/app/htmx.js', `public/dist/js/compiled-htmx.${version}.min.js`)
.js('./public/assets/js/app/htmx-headSupport.js', `public/dist/js/compiled-htmx-headSupport.${version}.min.js`)
Expand Down Expand Up @@ -45,7 +83,7 @@ mix
"./node_modules/@popperjs/core/dist/umd/popper.js",
"./node_modules/tippy.js/dist/tippy-bundle.umd.js",
"./public/assets/js/libs/slimselect.min.js",
"./public/assets/js/libs/confetti/js/confetti.js",
"./node_modules/canvas-confetti/dist/confetti.browser.js",
"./public/assets/js/libs/jquery.nyroModal/js/jquery.nyroModal.custom.js",
"./public/assets/js/libs/uppy/uppy.js",
"./node_modules/croppie/croppie.js",
Expand Down

0 comments on commit 7eafa1e

Please sign in to comment.