Skip to content

Commit

Permalink
feat(github share) confettis
Browse files Browse the repository at this point in the history
  • Loading branch information
enzonotario committed Oct 4, 2023
1 parent 56afd2d commit 22b358c
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 284 deletions.
36 changes: 35 additions & 1 deletion packages/playground/components/ShareGithubTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {useEditor} from "~/composables/app/useEditor"
import useAuth from "~/composables/useAuth"
import useOctokit from "~/composables/useOctokit"
import randomWords from 'random-spanish-words'
import confetti from 'canvas-confetti'
const emit = defineEmits(['close'])
Expand Down Expand Up @@ -99,7 +100,16 @@ async function submit() {
mode: '100644',
type: 'blob',
content: useEditor().code.value,
}
},
{
path: 'README.md',
mode: '100644',
type: 'blob',
content: `# ${state.value.name}
Aplicación Web desarrollada en [EsJS](https://esjs.dev/).`,
},
],
base_tree: currentCommit.data.commit.tree.sha,
})
Expand All @@ -123,6 +133,7 @@ async function submit() {
projectUrl.value = repo.data.html_url
projectCreated.value = true
confettis()
} catch (e) {
toast.add({
title: 'Ups!',
Expand All @@ -137,6 +148,29 @@ async function login() {
loadingLogin.value = true
await auth.login()
}
function confettis() {
const end = Date.now() + (3 * 1000);
(function frame() {
confetti({
particleCount: 2,
angle: 60,
spread: 55,
origin: { x: 0 },
});
confetti({
particleCount: 2,
angle: 120,
spread: 55,
origin: { x: 1 },
});
if (Date.now() < end) {
requestAnimationFrame(frame);
}
}());
}
</script>

<template>
Expand Down
1 change: 1 addition & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@types/node": "^18.17.3",
"@types/prettier": "^2.7.3",
"@vueuse/nuxt": "^10.3.0",
"canvas-confetti": "^1.6.0",
"eslint": "^8.47.0",
"h3-zod": "^0.5.1",
"javascript-obfuscator": "^4.0.2",
Expand Down
Loading

1 comment on commit 22b358c

@vercel
Copy link

@vercel vercel bot commented on 22b358c Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

editor – ./packages/playground

esjs-editor.vercel.app
editor-esjs.vercel.app
esjs-playground.vercel.app
editor-git-main-esjs.vercel.app
editor.esjs.dev

Please sign in to comment.