diff --git a/assets/styles/app.css b/assets/styles/app.css index 3672d01..9c4ddcf 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -65,7 +65,7 @@ strong, .strong { } a { - color: var(--color-primary); + color: var(--color-secondary); text-decoration: none; } @@ -170,6 +170,10 @@ svg.icon { list-style: none; } +.header__logo h1 { + font-weight: bold; +} + .header__logo img { height: 40px; /* Adjust the height as needed */ } diff --git a/assets/styles/theme.css b/assets/styles/theme.css index 245c2ca..bdcdac0 100644 --- a/assets/styles/theme.css +++ b/assets/styles/theme.css @@ -3,12 +3,13 @@ @import url('https://fonts.googleapis.com/css2?family=Josefin+Slab:ital,wght@0,100..700;1,100..700&display=swap'); :root { - --color-bg: #121212; /* Black background */ - --color-bg-light: #333; /* Lighter black background */ + --color-bg: #222; /* Black background */ + --color-bg-light: #444; /* Lighter black background */ + --color-bg-primary: #2b1a2b; --color-text: #ffffff; /* White text */ --color-text-mid: #eee; /* Light gray text */ --color-text-contrast: #000; /* Black text for contrast */ - --color-primary: #8e4585; /* Plum primary color */ + --color-primary: #a2559c; /* Plum primary color */ --color-secondary: #9CAF88; /* secondary color */ --color-border: #333; /* White border for contrast */ --font-family: 'Montserrat'; /* Set the Montserrat font as default */ diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 39e42b7..bcf5396 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -28,7 +28,7 @@ security: # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } + - { path: ^/admin, roles: ROLE_USER } # - { path: ^/profile, roles: ROLE_USER } when@test: diff --git a/migrations/Version20241210175624.php b/migrations/Version20241210175624.php new file mode 100644 index 0000000..ce7cab7 --- /dev/null +++ b/migrations/Version20241210175624.php @@ -0,0 +1,35 @@ +addSql('CREATE TABLE journal (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, npub VARCHAR(255) NOT NULL, main_categories JSON NOT NULL, lists JSON DEFAULT NULL, editor VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE app_user ALTER name DROP NOT NULL'); + $this->addSql('ALTER TABLE app_user ALTER display_name DROP NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE journal'); + $this->addSql('ALTER TABLE app_user ALTER name SET NOT NULL'); + $this->addSql('ALTER TABLE app_user ALTER display_name SET NOT NULL'); + } +} diff --git a/src/Entity/User.php b/src/Entity/User.php index 37f61d2..ed589c8 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -22,10 +22,10 @@ class User implements UserInterface #[ORM\Column(unique: true)] private ?string $npub = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] private ?string $name = null; - #[ORM\Column] + #[ORM\Column(nullable: true)] private ?string $displayName = null; #[ORM\Column(type: Types::TEXT, nullable: true)] diff --git a/src/Repository/UserEntityRepository.php b/src/Repository/UserEntityRepository.php index 2df090f..cd682c4 100644 --- a/src/Repository/UserEntityRepository.php +++ b/src/Repository/UserEntityRepository.php @@ -17,7 +17,7 @@ class UserEntityRepository extends ServiceEntityRepository { $entity = $this->findOneBy(['npub' => $user->getNpub()]); - if ($entity) { + if (!!$entity) { $user->setId($entity->getId()); } $this->entityManager->persist($user); diff --git a/templates/base.html.twig b/templates/base.html.twig index c027b68..49d8a7e 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -4,6 +4,7 @@ {% block title %}Newsroom{% endblock %} + {% block stylesheets %} {% endblock %} {% block javascripts %} @@ -17,7 +18,8 @@
{% block body %}{% endblock %} diff --git a/templates/components/UserMenu.html.twig b/templates/components/UserMenu.html.twig index b202d9a..88c0169 100644 --- a/templates/components/UserMenu.html.twig +++ b/templates/components/UserMenu.html.twig @@ -1,9 +1,25 @@
{% if app.user %}

Hello, {{ app.user.displayName }}

- - Log out + {% if is_granted('ROLE_ADMIN') %} + + {% endif %} + {% else %} - Log in + {{ 'heading.logIn'|trans }} {% endif %}
diff --git a/templates/home.html.twig b/templates/home.html.twig index 00d37a6..c08e6ad 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -1,7 +1,6 @@ {% extends 'base.html.twig' %} {% block nav %} - {% endblock %} {% block body %} diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml index 3b016ea..0a1dc67 100644 --- a/translations/messages.en.yaml +++ b/translations/messages.en.yaml @@ -1,4 +1,6 @@ text: - byline: 'By' + byline: 'By' heading: - roles: 'Roles' + roles: 'Roles' + logout: 'Log out' + logIn: 'Log in'