Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign #284

Merged
merged 107 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ea2384a
Remove unnecessary tempalte variable
tbrlpld Mar 8, 2024
a6a53f0
Remove the hardcoded header links
tbrlpld Mar 9, 2024
5043bcb
Remove tests for hardcoded links
tbrlpld Mar 9, 2024
1421f20
Remove projects from home page
tbrlpld Mar 9, 2024
8ab555c
Add a body field with section block to the home page
tbrlpld Mar 9, 2024
e88f5b9
Simplidy the admin url
tbrlpld Mar 9, 2024
34906f0
Remove the need for heading block templates
tbrlpld Mar 9, 2024
146aaa2
Add link blocks
tbrlpld Mar 9, 2024
3a4f385
Require content to be added through sections
tbrlpld Mar 15, 2024
47db9e2
Remove stack overflow link
tbrlpld Mar 15, 2024
9053cf4
Smaller social links with underline
tbrlpld Mar 15, 2024
623f4fa
Improve icon layout on smaller screens
tbrlpld Mar 15, 2024
e85f195
Add inter font
tbrlpld Mar 15, 2024
dba4148
Ensure page it at least 1 screen tall
tbrlpld Mar 15, 2024
c1908eb
Remove font-size definitions
tbrlpld Mar 26, 2024
5c04a97
Fix viewport meta tag separator
tbrlpld Mar 30, 2024
a4c79e6
Hide nav in pattern lib on home page
tbrlpld Mar 30, 2024
a5ed413
Pattern lib: hide nav on header
tbrlpld Mar 30, 2024
92e4154
Smaller icon
tbrlpld Mar 30, 2024
fc61246
Remove footer background
tbrlpld Mar 30, 2024
3e5db26
Simply stack profile image and title
tbrlpld Mar 30, 2024
a6cb912
Smaller centered profile title
tbrlpld Mar 30, 2024
a2baec5
Move profile image to separate template
tbrlpld Mar 30, 2024
be39cd2
Create pattern lib context for markdown block
tbrlpld Mar 30, 2024
68e7d12
Move footer into the gutter wrapper
tbrlpld Mar 30, 2024
14ed466
Remove heading styles
tbrlpld Mar 30, 2024
d3cc835
Slightly increase base font weight
tbrlpld Mar 30, 2024
8066e11
Don't use heading template on home
tbrlpld Mar 30, 2024
3994704
Slightly increase emphasis weight in prose
tbrlpld Mar 30, 2024
8348aed
Use hgroup for title and subtitle
tbrlpld Mar 31, 2024
40084f9
Hardcode "currently" section on homepage
tbrlpld Mar 31, 2024
ff18d3d
Update copy
tbrlpld Apr 1, 2024
381a1e9
Add link list
tbrlpld Apr 1, 2024
ccd36d6
Add left aligned profile
tbrlpld Apr 1, 2024
2c561e0
Lighter logo
tbrlpld Apr 1, 2024
e9ec140
Smaller and lighter social links
tbrlpld Apr 1, 2024
a301e1c
Slightly lighter hover for icon links
tbrlpld Apr 1, 2024
ccea3f1
Slightly darker headings on home page
tbrlpld Apr 1, 2024
56a46c4
Add hr above footer
tbrlpld Apr 1, 2024
dba41ce
Remove "tech" from "tech-pill"
tbrlpld Apr 1, 2024
a78bc00
Simplify listing link
tbrlpld Apr 1, 2024
835e0f5
Upgrade heroicons package
tbrlpld Apr 1, 2024
e67a008
Avoid line-break between icon and last word
tbrlpld Apr 1, 2024
338f34e
Rename listing link to chevron link
tbrlpld Apr 1, 2024
1620b0a
Fix component use
tbrlpld Apr 1, 2024
c910d2d
Add missing context file
tbrlpld Apr 1, 2024
b43da57
Fix icon name
tbrlpld Apr 2, 2024
5343ad2
Use link class for chevron link styling
tbrlpld Apr 2, 2024
a71a012
Use slightly wider gutters
tbrlpld Apr 2, 2024
835a4ca
Add slight chevron animation to link
tbrlpld Apr 2, 2024
50bdc0d
Use slightly tighter chevron animation
tbrlpld Apr 2, 2024
90e1766
Tiny increase of underline offset
tbrlpld Apr 2, 2024
3cc5f56
Use block display for listing links
tbrlpld Apr 2, 2024
c550861
Add "start" command for npm
tbrlpld Apr 4, 2024
89821a4
Fix social link hover border color
tbrlpld Apr 4, 2024
2f4c6d8
Use slimmer main body
tbrlpld Apr 4, 2024
125808c
Don't prescribe host platform in compose file
tbrlpld Jul 7, 2024
555b9ff
Handle empty profile image
tbrlpld Jul 7, 2024
f1dcd99
Add subtitle field to home page
tbrlpld Jul 7, 2024
af225c4
Remove center alignment markup
tbrlpld Jul 8, 2024
aee6c59
Even padding top and sides on mobile screens
tbrlpld Jul 8, 2024
99cb32e
Less spacing in the home page bottom on smaller screens
tbrlpld Jul 9, 2024
4236984
Update the dummy text for markdown
tbrlpld Jul 9, 2024
9157a2a
Disable primary navigtion in pattern lab on article
tbrlpld Jul 9, 2024
441b73d
Reduce distance between sections on article page
tbrlpld Jul 9, 2024
75fcdc1
Tighter and larger heading
tbrlpld Jul 9, 2024
9adeba2
Use an actually long article title
tbrlpld Jul 9, 2024
84abed4
Add spacing to top and bottom of article page
tbrlpld Jul 9, 2024
cc5befd
Remove size variable from heading tempalte
tbrlpld Jul 9, 2024
37683cb
Create a layout component for centered content
tbrlpld Jul 12, 2024
e951c91
Update top spacing to make the text start in a visual diagonal with logo
tbrlpld Jul 12, 2024
310ef52
Centrally define heading style and pass size to template
tbrlpld Jul 12, 2024
45ec6a7
Check level 4 heading style
tbrlpld Jul 12, 2024
445a907
Pass special prose styles as extra classes
tbrlpld Jul 12, 2024
8e0a02d
Move padding from component to parent
tbrlpld Jul 12, 2024
77ec8bd
Update top space after change to padding
tbrlpld Jul 12, 2024
812254c
Update paragraph block in section block
tbrlpld Jul 12, 2024
a4d3a25
Add some spacing between section body blocks
tbrlpld Jul 12, 2024
64fe615
Simplify the link listing
tbrlpld Jul 12, 2024
bb355a8
Remove hardcoded content from homepage
tbrlpld Jul 12, 2024
fdf1cd1
Increase top spacer height yet again
tbrlpld Jul 16, 2024
fad8972
Use title and subtitle for title tag on home page
tbrlpld Jul 16, 2024
9ce3e09
Add spacing to project page
tbrlpld Jul 16, 2024
7c6abbb
Add another component for vertial spacing
tbrlpld Jul 16, 2024
44710cc
Reduct pill font-size
tbrlpld Jul 16, 2024
568f96a
Allow project page under index page
tbrlpld Jul 18, 2024
b6f9067
Fix data structure for links on index page
tbrlpld Jul 18, 2024
50e84c3
Order index alphabetically
tbrlpld Jul 18, 2024
5b075b6
Revert "Order index alphabetically"
tbrlpld Jul 18, 2024
cb21af8
Use chevron link list on index page
tbrlpld Jul 18, 2024
a4e34a4
Add intro field to index page type
tbrlpld Jul 18, 2024
46d18ff
Set PLATFORM argument based on host
tbrlpld Jul 23, 2024
3d89d56
Add Inter font "locally"
tbrlpld Jul 23, 2024
5862971
Remove useless override
tbrlpld Jul 25, 2024
6446b36
Remove useless fontsize class
tbrlpld Jul 25, 2024
4f4d110
Remove empty class attr
tbrlpld Jul 25, 2024
655a67f
Remove block specific template
tbrlpld Jul 25, 2024
bb8c33a
Set inter font defintion on base layer
tbrlpld Jul 25, 2024
7eaa4f4
Set root fonts with Tailwind font families
tbrlpld Jul 25, 2024
cebf373
Add custom script to isntall
tbrlpld Jul 26, 2024
c2659ba
Use amd version when intel detected
tbrlpld Jul 26, 2024
c7cec81
Fix formatting
tbrlpld Jul 26, 2024
4ef58e2
Fix JS format
tbrlpld Jul 26, 2024
7ae0453
Merge branch 'main' into redesign
tbrlpld Jul 26, 2024
d5e379d
Clean up and documentation
tbrlpld Jul 26, 2024
8105180
Fix typos
tbrlpld Jul 26, 2024
da54ff3
Remove unused context variable from block
tbrlpld Jul 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ ENV PATH=${POETRY_HOME}/bin:$PATH \
PORT=8000
RUN env

# Install litestream (https://litestream.io/install/debian/)
ARG PLATFORM=amd64
RUN wget https://github.com/benbjohnson/litestream/releases/download/v0.3.9/litestream-v0.3.9-linux-$PLATFORM.deb
RUN dpkg -i litestream-v0.3.9-linux-$PLATFORM.deb
# Install litestream
COPY ./scripts/install-litestream.sh ./scripts/
RUN ./scripts/install-litestream.sh

# Install poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ Once your app is working, and you have TLS in place, you also configure:

This project is using SQLite as it's database -- even in production 😱.
Using SQLite is often discouraged to be used in production.
Those concerns a usually based on the abilitiy to handle multiple writes and how to backup the database.
Those concerns a usually based on the ability to handle multiple writes and how to backup the database.
For container deployments on a platform as a service (such as Heroku) there is also the problem of persisting the database between container restarts.

The write ability is not really an issue for this application.
Since this app is mainly a content site with few editors working simulaneously (if ever) it is much more read-heavy than write-heavy.
Since this app is mainly a content site with few editors working simultaneously (if ever), it is much more read-heavy than write-heavy.
Reads are easy for SQLite to handle.

The persistence problem does apply to this app though.
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ services:
build:
context: .
target: backend-development
args:
- PLATFORM=arm64
command: ["tail", "-f", "/dev/null"]
env_file:
- .env
Expand Down
109 changes: 107 additions & 2 deletions lpld/core/blocks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from wagtail import blocks
from wagtail.admin import panels
from wagtail.templatetags import wagtailcore_tags


class HeadingBlock(blocks.StructBlock):
Expand All @@ -8,15 +9,119 @@ class HeadingBlock(blocks.StructBlock):
panels = [panels.FieldPanel("text", classname="full")]

class Meta:
template = "atoms/heading/heading-block.html"
template = "atoms/heading/heading.html"
icon = "title"

def get_context(self, value, parent_context=None):
return {
"level": 2,
"children": value.get("text"),
}


class SubheadingBlock(blocks.StructBlock):
text = blocks.CharBlock(required=True)

panels = [panels.FieldPanel("text")]

class Meta:
template = "atoms/heading/subheading-block.html"
template = "atoms/heading/heading.html"
icon = "title"

def get_context(self, value, parent_context=None):
return {
"level": 3,
"children": value.get("text"),
}


class PageLinkBlock(blocks.StructBlock):
page = blocks.PageChooserBlock(required=True)
text = blocks.CharBlock(
required=False,
help_text="Text for the link. Defaults to page title.",
)

class Meta:
icon = "doc-full"
template = "atoms/link/link.html"

def get_context(self, value, parent_context=None):
page = value.get("page")
text = value.get("text")
return {
"text": text or page.title,
"href": page.get_url(),
}


class LinkStream(blocks.StreamBlock):
"""
Stream of links.
Each item should return context objects containing the keys `"text"` and `"href"`
from their `get_context` method.
"""

page_link = PageLinkBlock()

class Meta:
icon = "list-ul"
template = "molecules/link-listing/link-listing.html"
min_num = 1

def get_context(self, value, parent_context=None):
links = [bb.block.get_context(bb.value) for bb in value]
return {"links": links}


class LinkBlock(LinkStream):
"""
Link stream with max 1 item.
Can be used as a flexible link block.
"""

class Meta:
icon = "link"
template = "atoms/link/link.html"
min_num = 1
max_num = 1

def get_context(self, value, parent_context=None):
bound_block = value[0]
return bound_block.block.get_context(bound_block.value)


class SimpleProseRichtext(blocks.RichTextBlock):
def __init__(self, *args, **kwargs):
if "features" not in kwargs:
kwargs["features"] = ["link", "bold", "italics"]
super().__init__(*args, **kwargs)

class Meta:
template = "organisms/prose/prose.html"

def get_context(self, value, parent_context=None) -> dict[str, str]:
return {"children": wagtailcore_tags.richtext(value)}


class SectionBlock(blocks.StructBlock):
heading = HeadingBlock()
body = blocks.StreamBlock(
local_blocks=[
("paragraph", SimpleProseRichtext()),
("link_list", LinkStream()),
],
min_rum=1,
required=False,
)

panels = [
panels.FieldPanel("heading"),
panels.FieldPanel("body"),
]

class Meta:
template = "molecules/section/section-block.html"
icon = "bars"
29 changes: 16 additions & 13 deletions lpld/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from wagtail import models as wagtail_models
from wagtail.admin import panels

from lpld.navigation import utils as nav_utils


class BasePage(wagtail_models.Page):
class Meta(wagtail_models.Page.Meta):
Expand All @@ -15,10 +13,22 @@ class Meta(wagtail_models.Page.Meta):
def title_tag_content(self):
return self.get_title_tag_content()

def get_title_tag_content(self):
title_text = self.seo_title or self.title
title_text = f"{ title_text } · lpld.io"
return title_text
def get_title_tag_content(self) -> str:
parts = self.get_title_tag_parts()
sep = self.get_title_separator()
return sep.join(parts)

def get_title_tag_parts(self) -> list[str]:
title = self.seo_title or self.title
last = self.get_title_tag_last_part()
return [title, last]

def get_title_tag_last_part(self) -> str:
"""Return the last part for the title tag."""
return "lpld.io"

def get_title_separator(self) -> str:
return " · "

@func_utils.cached_property
def meta_description(self):
Expand All @@ -27,13 +37,6 @@ def meta_description(self):
def get_meta_description(self):
return self.search_description or ""

def get_context(self, request):
context = super().get_context(request)
context["primary_navigation_links"] = nav_utils.get_primary_navigation_links(
request
)
return context


class AbstractLink(models.Model):
page = models.ForeignKey(
Expand Down
43 changes: 43 additions & 0 deletions lpld/home/migrations/0004_homepage_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 4.1.13 on 2024-03-09 00:37

from django.db import migrations

import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):
dependencies = [
("home", "0003_homepage_profile_image"),
]

operations = [
migrations.AddField(
model_name="homepage",
name="body",
field=wagtail.fields.StreamField(
[
(
"section",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.StructBlock(
[
(
"text",
wagtail.blocks.CharBlock(required=True),
)
]
),
)
]
),
)
],
blank=True,
use_json_field=True,
),
),
]
90 changes: 90 additions & 0 deletions lpld/home/migrations/0005_homepage_subtitle_alter_homepage_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Generated by Django 4.1.13 on 2024-07-07 23:51

from django.db import migrations, models

import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):
dependencies = [
("home", "0004_homepage_body"),
]

operations = [
migrations.AddField(
model_name="homepage",
name="subtitle",
field=models.CharField(blank=True, max_length=50),
),
migrations.AlterField(
model_name="homepage",
name="body",
field=wagtail.fields.StreamField(
[
(
"section",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.StructBlock(
[
(
"text",
wagtail.blocks.CharBlock(required=True),
)
]
),
),
(
"body",
wagtail.blocks.StreamBlock(
[
(
"paragraph",
wagtail.blocks.RichTextBlock(
features=["link", "bold", "italics"]
),
),
(
"link_list",
wagtail.blocks.StreamBlock(
[
(
"page_link",
wagtail.blocks.StructBlock(
[
(
"page",
wagtail.blocks.PageChooserBlock(
required=True
),
),
(
"text",
wagtail.blocks.CharBlock(
help_text="Text for the link. Defaults to page title.",
required=False,
),
),
]
),
)
]
),
),
],
min_rum=1,
required=False,
),
),
]
),
)
],
blank=True,
use_json_field=True,
),
),
]
Loading
Loading