Skip to content

Commit

Permalink
Merge pull request #72 from Web3-Builders-Alliance/main
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMarchetto authored Jun 8, 2023
2 parents c1df345 + 314a6ab commit effc464
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: './ui'
tagName: pre-alpha-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'Soda v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version.
releaseBody: 'See the assets to download and install this version.'
releaseBody: 'This is a very early unaudited and untested release, DO NOT USE IT unless you now what are you doing.\nIn order to use the program you will need to:\n\nDownload the installation files for your OS\nInstall soda\nDownload the template.zip file\nDecompress template.zip'
releaseDraft: true
prerelease: false
10 changes: 5 additions & 5 deletions ui/helpers/egg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { message } from "@tauri-apps/api/dialog";
import { invoke } from "@tauri-apps/api/tauri";

const egg = () => {
invoke("egg")
.then(
()=>{console.log("Egg");}
)
invoke("egg")
.then(() => {
console.log("Egg");
})
.catch(async (e) => {
await message(e, { title: "Error", type: "error" });
});
};

export default egg;
export default egg;
5 changes: 4 additions & 1 deletion ui/helpers/nameSetter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { egg } from "@/helpers";
const nameSetter = (name: string, setName: Function) => name === (process.env.egg ?? "Chewing Glass") ? egg() : setName(name);
const nameSetter = (name: string, setName: Function) => {
if (name === (process.env.egg ?? "Chewing Glass")) egg();
setName(name);
}
export default nameSetter;
6 changes: 3 additions & 3 deletions ui/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images:{unoptimized: true}
}
images: { unoptimized: true },
};

module.exports = nextConfig
module.exports = nextConfig;
152 changes: 67 additions & 85 deletions ui/pages/egg.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Head from "next/head";
import { useEffect, useState } from "react";

interface Bubble {
Expand All @@ -16,96 +15,79 @@ export default function Egg() {
const id = setInterval(() => {
if (bubbles.some((bubble) => bubble.y < 0)) {
setIsPlaying(false);
} else {
setBubbles((bubbles) => [
...bubbles.map((bubble) => {
return {
...bubble,
y: bubble.y - Math.random() * Math.sqrt(count ? count * 2 : 2),
};
}),
...(Math.sqrt(count ? count : 2) > Math.random() * 10
? [
{
x: Math.random() * 100,
y: 100,
timestamp: Date.now(),
},
]
: []),
]);
}
setBubbles((bubbles) => {
const newBubble = {
x: Math.random() * 100,
y: 100,
timestamp: Date.now(),
};
return Math.random() * 2 > 1.5
? [
...bubbles.map((bubble) => {
return {
...bubble,
y:
bubble.y -
(count < 30
? Math.random() * 2
: (Math.random() * count) / 3),
};
}),
newBubble,
]
: [
...bubbles.map((bubble) => {
return {
...bubble,
y:
bubble.y -
(count < 30
? Math.random() * 2
: (Math.random() * count) / 10),
};
}),
];
});
}, 300);
return () => clearInterval(id);
});

return (
<>
<Head>
<title>Soda</title>
<meta name="description" content="Generate your project from an UI" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="bg-neutral-900 flex min-h-screen min-w-screen overflow-hidden max-h-screen max-w-screen p-5">
<div className="min-w-full min-h-full relative">
<h1
className={`absolute transform -translate-x-1/2 -translate-y-1/2 duration-1000 ${isPlaying ? "text-green-500" : "text-red-700" } text-5xl`}
style={{
top: `2%`,
left: `90%`,
}}
>
{count}
</h1>
{isPlaying ? bubbles?.map((bubble) => {
console.log(bubble);
return (
<div
key={bubble.timestamp}
className="absolute transform -translate-x-1/2 -translate-y-1/2 transition-all duration-1000"
style={{
top: `${bubble.y}%`,
left: `${bubble.x}%`,
}}
onClick={() => {
setBubbles(
bubbles.filter((b) => {
return b.timestamp !== bubble.timestamp;
})
);
setCount(count + 1);
}}
>
<div className="w-5 h-5 p-5 rounded-full bg-[#9ff] border border-blue-300"></div>
</div>
);
}): (
<div className="flex justify-center items-center">
<button
className="px-5 py-2 mt-5 bg-green-600 rounded text-green-200 font-semibold hover:text-green-100 hover:ring-2 hover:ring-green-200"
onClick={() => {setIsPlaying(true); setCount(0); setBubbles([])}}
>Play Again!</button>
<main className="bg-neutral-900 flex min-h-screen min-w-screen overflow-hidden max-h-screen max-w-screen p-5">
<div className="min-w-full min-h-full relative">
<h1
className={`absolute transform -translate-x-1/2 -translate-y-1/2 duration-1000 text-5xl ${
isPlaying ? "text-green-500" : "text-red-700"
}`}
style={{
top: `2%`,
left: `90%`,
}}
>
{count}
</h1>
{isPlaying ? (
bubbles?.map((bubble) => (
<div
key={bubble.timestamp}
className="absolute transform -translate-x-1/2 -translate-y-1/2 transition-all duration-1000 ease-linear"
style={{
top: `${bubble.y}%`,
left: `${bubble.x}%`,
}}
onClick={() => {
setBubbles(
bubbles.filter((b) => {
return b.timestamp !== bubble.timestamp;
})
);
setCount(count + 1);
}}
>
<div className="w-5 h-5 p-5 rounded-full bg-[#9ff] border border-blue-300"></div>
</div>
)
}
</div>
</main>
</>
))
) : (
<div className="flex justify-center items-center">
<button
className="px-5 py-2 mt-5 bg-green-600 rounded text-green-200 font-semibold hover:text-green-100 hover:ring-2 hover:ring-green-200"
onClick={() => {
setIsPlaying(true);
setCount(0);
setBubbles([]);
}}
>
Play Again!
</button>
</div>
)}
</div>
</main>
);
}
2 changes: 1 addition & 1 deletion ui/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};
2 changes: 1 addition & 1 deletion ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "soda",
"version": "0.0.3"
"version": "0.0.4-alpha"
},
"tauri": {
"allowlist": {
Expand Down
4 changes: 2 additions & 2 deletions ui/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module.exports = {
"./app/**/*.{js,ts,jsx,tsx}",
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",

// Or if using `src` directory:
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
};

0 comments on commit effc464

Please sign in to comment.