Browse Source

Refactor config

imwald
Nuša Pukšič 9 months ago
parent
commit
a8bbc28209
  1. 6
      .env.dist
  2. 0
      assets/theme/default/icons/apple-touch-icon.png
  3. 0
      assets/theme/default/icons/favicon-96x96.png
  4. 0
      assets/theme/default/icons/favicon.ico
  5. 0
      assets/theme/default/icons/web-app-manifest-192x192.png
  6. 0
      assets/theme/default/icons/web-app-manifest-512x512.png
  7. 30
      assets/theme/default/theme.css
  8. 0
      assets/theme/local/.gitignore
  9. 2
      config/packages/asset_mapper.yaml
  10. 8
      config/packages/twig.yaml
  11. 6
      config/services.yaml
  12. 13
      config/unfold.yaml
  13. 29
      docs/features.md
  14. 20
      src/Controller/ArticleController.php
  15. 8
      templates/base.html.twig
  16. 2
      templates/components/Footer.html.twig
  17. 2
      templates/components/Header.html.twig
  18. 5
      templates/components/UserMenu.html.twig
  19. 6
      templates/pages/category.html.twig
  20. 9
      templates/static/manifest.webmanifest.twig

6
.env.dist

@ -35,9 +35,3 @@ MYSQL_ROOT_PASSWORD=root_password @@ -35,9 +35,3 @@ MYSQL_ROOT_PASSWORD=root_password
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@database:3306/${MYSQL_DATABASE}?serverVersion=${MYSQL_VERSION}&charset=${MYSQL_CHARSET}"
###< doctrine/doctrine-bundle ###
###> magazine settings ###
MAGAZINE_NPUB=<mag-npub>
MAGAZINE_D_TAG=<mag-d-tag>
DEFAULT_RELAY_URL=wss://legend.relay.com
###< magazine settings ###

0
assets/icons/apple-touch-icon.png → assets/theme/default/icons/apple-touch-icon.png

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

0
assets/icons/favicon-96x96.png → assets/theme/default/icons/favicon-96x96.png

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
assets/icons/favicon.ico → assets/theme/default/icons/favicon.ico

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

0
assets/icons/web-app-manifest-192x192.png → assets/theme/default/icons/web-app-manifest-192x192.png

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

0
assets/icons/web-app-manifest-512x512.png → assets/theme/default/icons/web-app-manifest-512x512.png

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

30
assets/theme/default/theme.css

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');
:root {
--color-bg: #1a1a1a; /* Deep charcoal background */
--color-bg-light: #2a2a2a; /* Slightly lighter charcoal */
--color-bg-primary: #2e1f2e; /* Muted aubergine for a rich, elegant feel */
--color-text: #f5f5f5; /* Soft white for readability */
--color-text-mid: #d8d8d8; /* Warm light gray */
--color-text-contrast: #000; /* Black text for contrast */
--color-primary: #5F7355; /* Plum primary color */
--color-secondary: #495544; /* secondary color */
--color-border: #3a3a3a; /* Subtle gray border */
--font-family: 'Montserrat', serif; /* Set the Montserrat font as default */
--main-body-font: 'Newsreader', serif; /* Set the font for the main body */
--heading-font: 'EB Garamond', serif; /* Set the font for headings */
--brand-font: 'Lobster', serif; /* A classic, refined branding font */
--brand-color: white;
}
[data-theme="light"] {
--color-bg: #f4f1ee;
--color-bg-light: #e8e4df;
--color-text: #2a2a2a;
--color-text-mid: #3a3a3a; /* Warm light gray */
--color-text-contrast: #f4f1ee;
--brand-color: black;
}

0
assets/theme/local/.gitignore vendored

2
config/packages/asset_mapper.yaml

@ -2,6 +2,8 @@ framework: @@ -2,6 +2,8 @@ framework:
asset_mapper:
# The paths to make available to the asset mapper.
paths:
- assets/theme/local # Highest priority (overrides)
- assets/theme/default # Fallback if file not found in local
- assets/
missing_import_mode: strict

8
config/packages/twig.yaml

@ -1,5 +1,13 @@ @@ -1,5 +1,13 @@
twig:
file_name_pattern: '*.twig'
globals:
website_name: '%name%'
website_short_name: '%short_name%'
website_description: '%description%'
website_theme: '%theme%'
website_theme_color: '%theme_color%'
website_bg_color: '%theme_bg_color%'
magazine_community_articles: '%community_articles%'
when@test:
twig:

6
config/services.yaml

@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
default_relay_url: '%env(DEFAULT_RELAY_URL)%'
imports:
- { resource: unfold.yaml }
services:
# default configuration for services in *this* file
@ -28,4 +28,4 @@ services: @@ -28,4 +28,4 @@ services:
- '%env(DATABASE_URL)%'
App\Service\NostrClient:
arguments:
$defaultRelayUrl: '%default_relay_url%'
$defaultRelayUrl: '%default_relay%'

13
config/unfold.yaml

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
parameters:
name: 'Unfold Magazine'
short_name: 'Unfold'
description: 'Unfolding nostr magazines and community articles'
default_relay: 'wss://TheForest.nostr1.com'
theme: 'space'
theme_color: '#000000'
theme_bg_color: '#ffffff'
npub: 'npub1ez09adke4vy8udk3y2skwst8q5chjgqzym9lpq4u58zf96zcl7kqyry2lz'
d_tag: 'unfold-magazine'
community_articles: true

29
docs/features.md

@ -1,29 +1,10 @@ @@ -1,29 +1,10 @@
# Features
## Search Functionality (REMOVED)
- **Status**: Being removed as part of scaling down
- **Previous implementation**: Used Elasticsearch via FOSElasticaBundle
- **Replacement**: Will need basic database-based search for articles by title/content if search is still needed
- **Components affected**:
- SearchComponent (Twig component)
- FeaturedList component
- Article indexing commands
- Controllers using Elasticsearch queries
## Credit System (REMOVED)
- **Status**: Completely removed as part of scaling down
- **Previous implementation**: Credit-based search system with Redis storage
- **Components removed**:
- Entire `src/Credits/` directory (CreditsManager, RedisCreditStore, CreditTransaction entity)
- GetCreditsComponent (Twig component for adding credits)
- CreditTransactionController (admin interface)
- Credit accounting in SearchComponent
- Credit balance display in search interface
- Credits cache configuration
- Credit translation keys
## Core Features to Preserve
## Core Features
- Article management (CRUD operations)
- Article display and listing
- Author pages
- Basic article filtering (should use database queries instead of Elasticsearch)
- Basic article filtering (uses database queries)
- Configurable magazine name and short name via YAML and .env
- Theme selection (currently: purple)
- Community articles feature (enable/disable via config)

20
src/Controller/ArticleController.php

@ -255,4 +255,24 @@ class ArticleController extends AbstractController @@ -255,4 +255,24 @@ class ArticleController extends AbstractController
]);
}
/**
* Display latest 20 community articles
*/
#[Route('/articles', name: 'articles')]
public function latestArticles(EntityManagerInterface $entityManager): Response
{
$articles = $entityManager->getRepository(Article::class)
->findBy([], ['createdAt' => 'DESC'], 20);
$category = (object) [
'title' => 'Community Articles',
'summary' => 'Latest articles from the community',
];
return $this->render('pages/category.html.twig', [
'category' => $category,
'list' => $articles,
]);
}
}

8
templates/base.html.twig

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
<!DOCTYPE html>
<html lang="en" data-theme="{{ app.session.get('theme', 'light') }}">
<html lang="en" data-theme="{{ website_theme }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Decent Newsroom{% endblock %}</title>
<meta name="description" content="Decentralised Newsroom - the future of journalism">
<title>{% block title %}{{ website_name }}{% endblock %}</title>
<meta name="description" content="{{ website_description }}">
<link rel="icon" type="image/png" href="{{ asset('icons/favicon-96x96.png') }}" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="{{ asset('icons/favicon.svg') }}" />
<link rel="shortcut icon" href="{{ asset('icons/favicon.ico') }}" />
<link rel="apple-touch-icon" href="{{ asset('icons/apple-touch-icon.png') }}">
<meta name="apple-mobile-web-app-title" content="Newsroom" />
<meta name="apple-mobile-web-app-title" content="{{ website_short_name }}" />
<link rel="manifest" href="{{ path('pwa_manifest') }}">

2
templates/components/Footer.html.twig

@ -1 +1 @@ @@ -1 +1 @@
<p>{{ "now"|date("Y") }} Unfold Demo</p>
<p>{{ "now"|date("Y") }} {{ website_name }}</p>

2
templates/components/Header.html.twig

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<header class="header" data-controller="menu" {{ attributes }}>
<div class="header__logo">
<h1 class="brand"><a href="/">unfold</a></h1>
<h1 class="brand"><a href="/">{{ website_name }}</a></h1>
<button class="hamburger btn btn-secondary" data-action="click->menu#toggle" aria-label="Menu">&#9776;</button>
</div>
<div class="header__categories" data-menu-target="menu">

5
templates/components/UserMenu.html.twig

@ -12,6 +12,11 @@ @@ -12,6 +12,11 @@
{# </ul>#}
{% endif %}
<ul class="user-nav">
{% if magazine_community_articles %}
<li>
<a href="{{ path('articles') }}">Latest Articles</a>
</li>
{% endif %}
{# <li>#}
{# <a href="{{ path('editor-create') }}">Write an article</a>#}
{# </li>#}

6
templates/pages/category.html.twig

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
{% extends 'base.html.twig' %}
{% block ogtags %}
<meta property="og:title" content="{{ category.title }} - Newsroom">
<meta property="og:title" content="{{ category.title }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ app.request.uri }}">
<meta property="og:description" content="{{ category.summary }}">
<meta property="og:site_name" content="Newsroom">
<meta property="og:site_name" content="{{ website_name }}">
{% endblock %}
{% block nav %}
@ -16,6 +16,4 @@ @@ -16,6 +16,4 @@
{% endblock %}
{% block aside %}
{# <h6>Magazines</h6>#}
{# <twig:Organisms:ZineList />#}
{% endblock %}

9
templates/static/manifest.webmanifest.twig

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
{
"name": "Decent Newsroom",
"short_name": "Newsroom",
"name": "{{ website_name }}",
"short_name": "{{ website_short_name }}",
"description": "{{ website_description }}",
"start_url": "/?source=pwa",
"icons": [
{
@ -14,7 +15,7 @@ @@ -14,7 +15,7 @@
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"theme_color": "{{ website_theme_color }}",
"background_color": "{{ website_bg_color }}",
"display": "standalone"
}

Loading…
Cancel
Save