Skip to content

Commit

Permalink
✨ feature(frontend): switch to macaron
Browse files Browse the repository at this point in the history
  • Loading branch information
fawni committed Dec 13, 2023
1 parent 088efa7 commit 846ed41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion templates/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
window.location.href = "/";
}
else {
notyf.error(await res.text());
macaron.error(await res.text());
}
};

Expand Down
11 changes: 5 additions & 6 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@
});

if (res.status == 201) {
notyf.success("whisper sent");
window.location.reload();
macaron.success("whisper sent! click to reload", {action: () => window.location.reload()});
}
else if (res.status == 429) {
notyf.error("too many whispers, slow down");
macaron.error("too many whispers, slow down");
}
else {
notyf.error(await res.text());
macaron.error(await res.text());
}
};

const copySnowflake = (snowflake) => {
navigator.clipboard.writeText(snowflake);
notyf.success("copied whisper id");
macaron.success("copied whisper id");
};

const deleteWhisper = async (snowflake) => {
Expand All @@ -53,7 +52,7 @@
window.location.reload();
}
else {
notyf.error(await res.text());
macaron.error(await res.text());
}
};
</script>
Expand Down
23 changes: 8 additions & 15 deletions templates/layout/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
<link rel="preconnect" href="https://unpkg.com">

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" >
<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura-vader.css">
<link rel="stylesheet" href="https://unpkg.com/@csstools/normalize.css" />
<link rel="stylesheet" href="https://unpkg.com/notyf/notyf.min.css">
<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura-vader.css">
<link rel="stylesheet" href="https://unpkg.com/@twinking/macaron/src/macaron.css">

<script src="https://unpkg.com/notyf/notyf.min.js"></script>
<script src="https://unpkg.com/@twinking/macaron/dist/macaron.js" type="text/javascript"></script>

<style>
:root{
--macaron-bg: #40363a;
--macaron-fg: #d9d8dc;
}

::selection {
background-color: #eb99a1;
color: #d9d8dc;
Expand Down Expand Up @@ -141,18 +146,6 @@ <h1>~{{user.name}}</h1>
<div id="mascot">
<img src="/assets/mascot.png" alt="tamako mascot" />
</div>

<script type="application/javascript">
var notyf = new Notyf({
duration: 2500,
position: {
x: 'right',
y: 'top',
},
ripple: false,
dismissible: true,
});
</script>
</body>

</html>

0 comments on commit 846ed41

Please sign in to comment.