Luca448 commited on
Commit
932d5b4
·
1 Parent(s): 4ea5ce7

Feat: Add implicit Allgemeine News to background generator and UI

Browse files
server/news-service.js CHANGED
@@ -186,7 +186,8 @@ async function runGenerationCycle(simulateError = false) {
186
  }
187
 
188
  // Shuffle topics and process them
189
- const topicsToProcess = [...data.topics];
 
190
 
191
  let newArticles = 0;
192
  for (const topic of topicsToProcess) {
 
186
  }
187
 
188
  // Shuffle topics and process them
189
+ const topicsSet = new Set(['Allgemeine News', ...data.topics]);
190
+ const topicsToProcess = Array.from(topicsSet);
191
 
192
  let newArticles = 0;
193
  for (const topic of topicsToProcess) {
src/views/news/news-view.js CHANGED
@@ -52,13 +52,12 @@ export class NewsView {
52
 
53
  <!-- Top Tab Bar (TikTok/Perplexity style) -->
54
  <div style="padding: 0 24px; margin-bottom: 24px; display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(255,255,255,0.05);">
55
- ${['Alle', ...this.topics].map(t => `
56
  <div class="topic-tab ${this.activeTopic === t ? 'active' : ''}" data-topic="${t}" style="padding-bottom: 12px; font-size: 15px; font-weight: ${this.activeTopic === t ? '600' : '500'}; color: ${this.activeTopic === t ? '#fff' : 'var(--text-secondary)'}; cursor: pointer; position: relative; white-space: nowrap;">
57
  ${t}
58
  ${this.activeTopic === t ? '<div style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #c183f0; border-radius: 2px 2px 0 0;"></div>' : ''}
59
  </div>
60
  `).join('')}
61
- ${this.topics.length === 0 && !this.isLoading ? '<div style="color: var(--text-secondary); font-size: 14px; padding-bottom: 12px;">Keine Themen konfiguriert.</div>' : ''}
62
  </div>
63
 
64
  <div class="news-feed" style="padding: 0 16px; display: flex; flex-direction: column; gap: 20px;">
@@ -380,10 +379,6 @@ export class NewsView {
380
  if (triggerBtn) {
381
  triggerBtn.addEventListener('click', async () => {
382
  if (this.isGenerating) return;
383
- if (this.topics.length === 0) {
384
- alert('Bitte füge zuerst oben rechts über das ⚙️ Icon mindestens ein Thema hinzu!');
385
- return;
386
- }
387
 
388
  this.isGenerating = true;
389
  triggerBtn.textContent = 'Generiere (das kann 10-20 Sekunden dauern)...';
@@ -409,10 +404,6 @@ export class NewsView {
409
  if (simBtn) {
410
  simBtn.addEventListener('click', async () => {
411
  if (this.isGenerating) return;
412
- if (this.topics.length === 0) {
413
- alert('Bitte füge zuerst oben rechts über das ⚙️ Icon mindestens ein Thema hinzu!');
414
- return;
415
- }
416
 
417
  this.isGenerating = true;
418
  simBtn.textContent = 'Generiere... (Simulated Error) - Bitte warten...';
 
52
 
53
  <!-- Top Tab Bar (TikTok/Perplexity style) -->
54
  <div style="padding: 0 24px; margin-bottom: 24px; display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(255,255,255,0.05);">
55
+ ${['Alle', ...Array.from(new Set(['Allgemeine News', ...this.topics]))].map(t => `
56
  <div class="topic-tab ${this.activeTopic === t ? 'active' : ''}" data-topic="${t}" style="padding-bottom: 12px; font-size: 15px; font-weight: ${this.activeTopic === t ? '600' : '500'}; color: ${this.activeTopic === t ? '#fff' : 'var(--text-secondary)'}; cursor: pointer; position: relative; white-space: nowrap;">
57
  ${t}
58
  ${this.activeTopic === t ? '<div style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #c183f0; border-radius: 2px 2px 0 0;"></div>' : ''}
59
  </div>
60
  `).join('')}
 
61
  </div>
62
 
63
  <div class="news-feed" style="padding: 0 16px; display: flex; flex-direction: column; gap: 20px;">
 
379
  if (triggerBtn) {
380
  triggerBtn.addEventListener('click', async () => {
381
  if (this.isGenerating) return;
 
 
 
 
382
 
383
  this.isGenerating = true;
384
  triggerBtn.textContent = 'Generiere (das kann 10-20 Sekunden dauern)...';
 
404
  if (simBtn) {
405
  simBtn.addEventListener('click', async () => {
406
  if (this.isGenerating) return;
 
 
 
 
407
 
408
  this.isGenerating = true;
409
  simBtn.textContent = 'Generiere... (Simulated Error) - Bitte warten...';