Header Integration
This commit is contained in:
parent
59da4a7cc5
commit
a37d322994
13 changed files with 80 additions and 3 deletions
9
docs/frontend/header.md
Normal file
9
docs/frontend/header.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Header
|
||||
|
||||
``` bash
|
||||
cd /opt/instant-workstation/frontend/header
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
## Updates
|
||||
5
docs/frontend/index.md
Normal file
5
docs/frontend/index.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Frontend
|
||||
|
||||
| Frontend | Language | Toolchain | Route | Last Updated |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| [Header](header.md) | JavaScript | None | / | 2026-09-05 |
|
||||
|
|
@ -5,8 +5,12 @@
|
|||
```mermaid
|
||||
architecture-beta
|
||||
group backend(server)[Backend]
|
||||
group frontend(internet)[Frontend]
|
||||
|
||||
service workstations(server)[Workstations] in backend
|
||||
service header(internet)[Header] in frontend
|
||||
|
||||
header:R --> L:workstations
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
|
|
|||
BIN
frontend/header/assets/favicon.ico
Normal file
BIN
frontend/header/assets/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
|
@ -32,7 +32,8 @@
|
|||
}
|
||||
|
||||
.news-ticker-content {
|
||||
animation: news-ticker-animation 10s linear forwards;
|
||||
animation: news-ticker-animation 10s linear infinite;
|
||||
animation-play-state: paused;
|
||||
display: inline-block;
|
||||
padding-left: 100%;
|
||||
}
|
||||
|
|
@ -42,6 +43,11 @@
|
|||
transform: translateX(0);
|
||||
}
|
||||
|
||||
/* Finish the animation early to create a delay between announcements */
|
||||
90% {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link href="assets/favicon.ico" rel="icon">
|
||||
|
||||
<link href="css/brand.css" rel="stylesheet">
|
||||
<link href="css/header.css" rel="stylesheet">
|
||||
<link href="css/nav.css" rel="stylesheet">
|
||||
|
|
@ -11,13 +13,15 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<script src="news-ticker.js" type="module"></script>
|
||||
|
||||
<title>Instant Workstation</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="header">
|
||||
<a class="brand-link" href="/">
|
||||
<img alt="" class="brand-logo" src="logo.svg">
|
||||
<img alt="" class="brand-logo" src="assets/logo.svg">
|
||||
<span class="brand-title screen-wide">Instant Workstation</span>
|
||||
</a>
|
||||
|
||||
|
|
@ -28,7 +32,7 @@
|
|||
<a class="nav-link screen-wide" href="https://docs.instantworkstation.com">Technical Documentation</a>
|
||||
|
||||
<span class="news-ticker">
|
||||
<span class="news-ticker-content">Ubuntu 26.04 x86 64 LE is now available</span>
|
||||
<span class="news-ticker-content" id="news-ticker-content"></span>
|
||||
</span>
|
||||
|
||||
<a class="nav-link nav-link-account" href="/account">Account</a>
|
||||
46
frontend/header/news-ticker.js
Normal file
46
frontend/header/news-ticker.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
const response = await fetch('https://api.instantworkstation.com/workstations');
|
||||
const workstations = await response.json();
|
||||
|
||||
const now = new Date();
|
||||
const recent = new Date(now);
|
||||
|
||||
recent.setUTCDate(now.getUTCDate() - 30);
|
||||
recent.setUTCHours(0, 0, 0, 0);
|
||||
|
||||
const recentWorkstations = workstations.filter(isRecent);
|
||||
const news = recentWorkstations.flatMap(generateNews);
|
||||
const ticker = document.getElementById('news-ticker-content');
|
||||
|
||||
let index = 0;
|
||||
if (news.length > 0) {
|
||||
ticker.textContent = news[index];
|
||||
ticker.addEventListener('animationiteration', showNextAnnouncement);
|
||||
ticker.style.animationPlayState = 'running';
|
||||
}
|
||||
|
||||
function generateNews(workstation) {
|
||||
return workstation.architectures.map(architecture => {
|
||||
const workstationDetails = `${workstation.os} ${workstation.version}`;
|
||||
const architectureDetails = `${architecture.cpu} ${architecture.bitness} ${architecture.endianness}`;
|
||||
|
||||
return `${workstationDetails} ${architectureDetails} is now available`;
|
||||
});
|
||||
}
|
||||
|
||||
function isRecent(workstation) {
|
||||
const added = new Date(workstation.added);
|
||||
|
||||
return added >= recent;
|
||||
}
|
||||
|
||||
function showNextAnnouncement() {
|
||||
index++;
|
||||
|
||||
if (index < news.length) {
|
||||
ticker.textContent = news[index];
|
||||
} else {
|
||||
ticker.removeEventListener('animationiteration', showNextAnnouncement);
|
||||
ticker.style.animationPlayState = 'paused';
|
||||
ticker.textContent = '';
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,9 @@ nav:
|
|||
- Backend:
|
||||
- backend/index.md
|
||||
- Workstations: backend/workstations.md
|
||||
- Frontend:
|
||||
- frontend/index.md
|
||||
- Header: frontend/header.md
|
||||
- Overview: index.md
|
||||
plugins:
|
||||
- git-revision-date-localized:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue