ui redesign, markdown fix + metadata and auth header
This commit is contained in:
@@ -10,10 +10,29 @@ const { title, wide = false } = Astro.props;
|
||||
---
|
||||
|
||||
<Layout title={title} wide={wide}>
|
||||
<div class="glass p-6 md:p-12 mb-12" id="admin-content" style="display: none;">
|
||||
<Fragment slot="head">
|
||||
<script is:inline>
|
||||
(function () {
|
||||
try {
|
||||
var authed = document.cookie.split(';').some(function (c) {
|
||||
return c.trim().indexOf('admin_session=1') === 0;
|
||||
});
|
||||
if (!authed) {
|
||||
window.location.replace('/admin/login');
|
||||
return;
|
||||
}
|
||||
document.documentElement.classList.add('admin-authed');
|
||||
} catch (e) {
|
||||
window.location.replace('/admin/login');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</Fragment>
|
||||
|
||||
<div class="glass p-6 md:p-12 mb-12" id="admin-content">
|
||||
<header class="mb-8 md:mb-12 border-b border-white/5 pb-8 md:pb-12 flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
|
||||
<div>
|
||||
<a id="back-link" href="/admin" class="text-blue hover:text-sky transition-colors mb-4 md:mb-8 inline-flex items-center gap-2 group text-sm md:text-base" style="color: var(--blue) !important;">
|
||||
<a id="back-link" href="/admin" class="text-blue hover:text-sky transition-colors mb-4 md:mb-8 inline-flex items-center gap-2 group text-sm md:text-base">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="md:w-5 md:h-5 transition-transform group-hover:-translate-x-1"><path d="m15 18-6-6 6-6"/></svg>
|
||||
Back
|
||||
</a>
|
||||
@@ -32,20 +51,12 @@ const { title, wide = false } = Astro.props;
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const token = localStorage.getItem('admin_token');
|
||||
if (!token) {
|
||||
window.location.href = '/admin/login';
|
||||
} else {
|
||||
const content = document.getElementById('admin-content');
|
||||
if (content) content.style.display = 'block';
|
||||
|
||||
const backLink = document.getElementById('back-link');
|
||||
if (backLink && document.referrer && document.referrer.includes(window.location.host) && !document.referrer.includes('/admin/login')) {
|
||||
backLink.addEventListener('click', (ev) => {
|
||||
ev.preventDefault();
|
||||
window.history.back();
|
||||
});
|
||||
}
|
||||
const backLink = document.getElementById('back-link');
|
||||
if (backLink && document.referrer && document.referrer.includes(window.location.host) && !document.referrer.includes('/admin/login')) {
|
||||
backLink.addEventListener('click', (ev) => {
|
||||
ev.preventDefault();
|
||||
window.history.back();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user