Skip to content

Commit 4248082

Browse files
committed
feat: updated welcome page
1 parent bdbaa4e commit 4248082

File tree

7 files changed

+100
-12
lines changed

7 files changed

+100
-12
lines changed

src/locales/de.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
"index.recentPadsEmpty": "Keine kürzlich bearbeiteten Pads gefunden.",
5959
"index.generateNewPad": "Neues Pad generieren",
6060
"index.labelPad": "Padname (optional)",
61-
"pad.toolbar.bold.title": "Fett (Strg-B)",
61+
"index.placeholderPadEnter": "Gib den Namen des Pads ein...",
62+
"index.createAndShareDocuments": "Erstelle und teile Dokumente in Echtzeit",
63+
"index.createAndShareDocumentsDescription": "Etherpad ermöglicht die gemeinsame Bearbeitung von Dokumenten in Echtzeit, ähnlich wie ein Live-Multiplayer-Editor, der in Ihrem Browser läuft.",
64+
"pad.toolbar.bold.title": "Fett (Strg-B)",
6265
"pad.toolbar.italic.title": "Kursiv (Strg-I)",
6366
"pad.toolbar.underline.title": "Unterstrichen (Strg-U)",
6467
"pad.toolbar.strikethrough.title": "Durchgestrichen (Strg+5)",

src/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"index.recentPadsEmpty": "No recent pads found.",
4141
"index.generateNewPad": "Generate random pad name",
4242
"index.labelPad": "Pad name (optional)",
43+
"index.placeholderPadEnter": "Gib den Namen des Pads ein...",
44+
"index.createAndShareDocuments": "Create and share documents in real time",
45+
"index.createAndShareDocumentsDescription": "Etherpad allows you to edit documents collaboratively in real-time, much like a live multi-player editor that runs in your browser.",
4346

4447

4548
"pad.toolbar.bold.title": "Bold (Ctrl+B)",

src/static/js/pad_userlist.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ const paduserlist = (() => {
489489
online++;
490490
}
491491
}
492+
const recentPadsList = JSON.parse(localStorage.getItem('recentPads'));
493+
const pathSegments = window.location.pathname.split('/');
494+
const padName = pathSegments[pathSegments.length - 1];
495+
const existingPad = recentPadsList.find((pad) => pad.name === padName);
496+
if (existingPad) {
497+
existingPad.members = online;
498+
}
499+
localStorage.setItem('recentPads', JSON.stringify(recentPadsList));
500+
492501

493502
$('#online_count').text(online);
494503

src/static/skins/colibris/index.css

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,36 @@
66
--muted-border: oklch(87.2% 0.01 258.338);
77
--muted-background: hsl(240 4.8% 95.9%);
88
--ep-color: rgb(22 163 74);
9+
--warm-green-olive: #7c9a3e;
10+
--warm-green-moss: #8fae4a;
11+
--warm-green-lime: #b7c96c;
12+
--warm-green-avocado: #6e8b3d;
13+
--warm-green-spring: #a3c85a;
914
}
1015

1116

1217
body {
1318
border-top: 0;
1419
background: oklch(98.5% 0.002 247.839);
20+
display: flex;
21+
flex-direction: column;
1522
}
1623

1724
h1 {
1825
margin: auto 0 0;
1926
font-size: 26px;
2027
}
2128

29+
.mission-statement, .pad-datalist {
30+
display: block;
31+
}
32+
2233
.mission-statement h2 {
2334
font-weight: 700;
2435
font-size: 2.25rem;
2536
text-align: center;
26-
margin-top: 4rem;
37+
margin: 0;
38+
padding-top: 4rem;
2739
}
2840

2941
.mission-statement p {
@@ -165,6 +177,7 @@ body nav {
165177

166178
.pad-datalist {
167179
max-width: 56rem;
180+
margin-bottom: 1rem;
168181
}
169182

170183
.break-column {
@@ -183,6 +196,17 @@ ul {
183196
flex-direction: column;
184197
}
185198

199+
.body {
200+
flex-grow: 1;
201+
background: linear-gradient(
202+
to bottom right,
203+
#d1fae5, /* emerald-100 */
204+
#f0fdfa, /* teal-50 */
205+
#dbeafe, /* blue-100 */
206+
#c7d2fe /* indigo-200 */
207+
);
208+
}
209+
186210
.recent-pad:hover a {
187211
color: var(--ep-color);
188212
}
@@ -208,9 +232,27 @@ a, a:visited, a:hover, a:active {
208232
border-bottom-width: 1px;
209233
border-bottom-style: solid;
210234
border-bottom-color: #e5e7eb;
211-
width: 100%;
212235
}
213236

214237
.card-content {
215238
padding: 1.5rem;
216239
}
240+
241+
@media (max-width: 640px) {
242+
#inner {
243+
max-width: 100%;
244+
padding: 0 1rem;
245+
}
246+
247+
.mission-statement p {
248+
max-width: 100%;
249+
}
250+
251+
.pad-datalist {
252+
max-width: 90%;
253+
}
254+
255+
.mission-statement h2 {
256+
font-size: 1.5rem;
257+
}
258+
}

src/static/skins/colibris/index.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
11
'use strict';
22

3+
window.addEventListener('pageshow', (event) => {
4+
if (event.persisted) {
5+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
6+
window.customStart();
7+
} else {
8+
window.addEventListener('DOMContentLoaded', window.customStart, {once: true});
9+
}
10+
}
11+
});
312

413
window.customStart = () => {
14+
document.getElementById('recent-pads').replaceChildren()
515
// define your javascript here
616
// jquery is available - except index.js
717
// you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/
18+
const divHoldingPlaceHolderLabel = document
19+
.querySelector('[data-l10n-id="index.placeholderPadEnter"]');
20+
21+
const observer = new MutationObserver(() => {
22+
document.querySelector('#go2Name input')
23+
.setAttribute('placeholder', divHoldingPlaceHolderLabel.textContent);
24+
});
25+
26+
observer
27+
.observe(divHoldingPlaceHolderLabel, {childList: true, subtree: true, characterData: true});
28+
29+
830
const recentPadList = document.getElementById('recent-pads');
931
const parentStyle = recentPadList.parentElement.style;
1032
const recentPadListHeading = document.querySelector('[data-l10n-id="index.recentPads"]');
@@ -14,6 +36,12 @@ window.customStart = () => {
1436
recentPadListData = JSON.parse(recentPadsFromLocalStorage);
1537
}
1638

39+
// Remove duplicates based on pad name and sort by timestamp
40+
recentPadListData = recentPadListData.filter(
41+
(pad, index, self) =>
42+
index === self.findIndex((p) => p.name === pad.name)
43+
).sort((a, b) => new Date(a.timestamp) > new Date(b.timestamp) ? -1 : 1);
44+
1745
if (recentPadListData.length === 0) {
1846
recentPadListHeading.setAttribute('data-l10n-id', 'index.recentPadsEmpty');
1947
parentStyle.display = 'flex';

src/static/skins/colibris/pad.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
'use strict';
22

3+
const MAX_PADS_IN_HISTORY = 3;
4+
35
window.customStart = () => {
46
$('#pad_title').show();
57
$('.buttonicon').on('mousedown', function () { $(this).parent().addClass('pressed'); });
68
$('.buttonicon').on('mouseup', function () { $(this).parent().removeClass('pressed'); });
79

8-
const pathSegments = window.location.pathname.split('/').filter(Boolean);
10+
const pathSegments = window.location.pathname.split('/');
911
const padName = pathSegments[pathSegments.length - 1];
1012
const recentPads = localStorage.getItem('recentPads');
1113
if (recentPads == null) {
1214
localStorage.setItem('recentPads', JSON.stringify([]));
1315
}
1416
const recentPadsList = JSON.parse(localStorage.getItem('recentPads'));
1517
if (!recentPadsList.some((pad) => pad.name === padName)) {
16-
if (recentPadsList.length >= 10) {
18+
if (recentPadsList.length >= MAX_PADS_IN_HISTORY) {
1719
recentPadsList.shift(); // Remove the oldest pad if we have more than 10
1820
}
1921
recentPadsList.push({
2022
name: padName,
2123
timestamp: new Date().toISOString(), // Store the timestamp for sorting
22-
members: 0,
24+
members: 1,
2325
});
2426
localStorage.setItem('recentPads', JSON.stringify(recentPadsList));
2527
} else {

src/templates/index.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
width: 45px;
110110
height: 38px;
111111
}
112-
nav {
112+
nav, .mission-statement, .pad-datalist {
113113
display: none;
114114
}
115115

@@ -143,11 +143,10 @@ <h1>Etherpad</h1>
143143
</nav>
144144

145145

146+
<div class="body">
146147
<div class="mission-statement">
147-
<h2>Create and share documents</h2>
148-
<p>
149-
Etherpad allows you to edit documents collaboratively in real-time, much like a live multi-player editor that runs in your browser.
150-
</p>
148+
<h2 data-l10n-id="index.createAndShareDocuments"></h2>
149+
<p data-l10n-id="index.createAndShareDocumentsDescription"></p>
151150
</div>
152151

153152
<div id="wrapper">
@@ -161,18 +160,20 @@ <h2>Create and share documents</h2>
161160
<% } %>
162161
<form action="#" id="go2Name">
163162
<label id="label" for="padname" data-l10n-id="index.labelPad"></label>
164-
<input type="text" id="padname" maxlength="50" autofocus placeholder="Enter pad name...">
163+
<input type="text" id="padname" maxlength="50" autofocus placeholder="Enter pad name...">
165164
<button type="submit" data-l10n-id="index.createOpenPad"></button>
166165
</form>
167166
<% } %>
168167
</div>
169168
<% e.end_block(); %>
170169
</div>
170+
<div style="display: none" data-l10n-id="index.placeholderPadEnter"></div>
171171
<div class="pad-datalist">
172172
<h2 data-l10n-id="index.recentPads"></h2>
173173
<ul id="recent-pads">
174174
</ul>
175175
</div>
176+
</div>
176177
<script src="<%=entrypoint%>"></script>
177178

178179
<% e.begin_block("indexCustomScripts"); %>

0 commit comments

Comments
 (0)