8 Commits

  1. 25
      CHANGELOG.md
  2. 42
      assets/css/app.css
  3. 2
      lib/mirage/images.ex
  4. 30
      lib/mirage/notes.ex
  5. 6
      lib/mirage_web/live/inbox_live/item_component.ex
  6. 2
      lib/mirage_web/live/live_helpers.ex
  7. 2
      lib/mirage_web/live/search_live/index.html.leex
  8. 2
      lib/mirage_web/templates/layout/root.html.leex
  9. 2
      mix.exs
  10. 2
      priv/repo/migrations/20210108235219_create_notes.exs
  11. 9
      priv/repo/migrations/20210111174337_add_settings_data.exs

25
CHANGELOG.md

@ -5,6 +5,31 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.91.0](https://git.inhji.de/inhji/mirage/compare/v0.90.0...v0.91.0) (2021-03-28)
### Chores:
* mix format
### Features:
* kinda experimental fixed top bar, change primary to rebeccapurple <3
* use font-feature-settings of inter
* add create_daily_note/0
### Bug Fixes:
* adjust font weight for sidebar
* dont show pinned notes in untagged/linked
* clean up warnings
## [v0.90.0](https://git.inhji.de/inhji/mirage/compare/v0.89.1...v0.90.0) (2021-03-28)

42
assets/css/app.css

@ -23,7 +23,7 @@
--gray-dark: #343a40;
--gray-light: #cccccc;
--primary: mediumseagreen;
--primary: rebeccapurple;
--secondary: var(--gray);
--success: var(--green);
--info: var(--teal);
@ -44,8 +44,47 @@
body {
margin-left: calc(var(--width-sidebar) + var(--ok-s-3));
font-feature-settings: "calt", "case", "ss01", "ss02";
&.logged-out {
margin-left: auto;
margin-right: auto;
--width-sidebar: 0rem;
#main-header nav {
margin: 0 auto;
}
}
}
main {
padding-top: 4rem;
}
#main-header {
position: fixed;
padding: var(--ok-s-3);
width: 100%;
margin: auto;
left: var(--width-sidebar);
top: 0;
background: var(--dark);
color: var(--light);
nav {
max-width: 80ch;
margin: 0;
padding: 0 1rem;
a {
color: var(--light);
}
@media (--smol) {
padding: 0;
}
}
}
@ -119,6 +158,7 @@ nav#sidebar {
text-decoration: none;
width: 100%;
transition: all 0.3s;
font-weight: 300;
&:hover, &.active {
background-color: var(--primary);

2
lib/mirage/images.ex

@ -16,6 +16,6 @@ defmodule Mirage.Images do
end
def get_url(image, version \\ :wide) do
Mirage.Images.ImageUploader.url({image.name, image}, version)
ImageUploader.url({image.name, image}, version)
end
end

30
lib/mirage/notes.ex

@ -79,7 +79,7 @@ defmodule Mirage.Notes do
from n in Note,
full_join: nn in NoteNote,
on: nn.target_id == n.id or nn.source_id == n.id,
where: not (like(n.title, "@%") or like(n.title, "____-__-__")),
where: not (like(n.title, "@%") or like(n.title, "#%") or like(n.title, "____-__-__")),
where: is_nil(nn.target_id) or is_nil(nn.source_id),
select: n,
limit: 3,
@ -93,7 +93,7 @@ defmodule Mirage.Notes do
from n in Note,
full_join: t in NoteTopic,
on: t.note_id == n.id,
where: not (like(n.title, "@%") or like(n.title, "____-__-__")),
where: not (like(n.title, "@%") or like(n.title, "#%") or like(n.title, "____-__-__")),
where: is_nil(t.id),
select: n,
limit: 3,
@ -103,11 +103,9 @@ defmodule Mirage.Notes do
end
def list_notes(:today) do
date_title = today_title()
q =
from n in Note,
where: n.title == ^date_title,
where: n.title == ^today_title(),
select: n
note =
@ -116,20 +114,26 @@ defmodule Mirage.Notes do
[note]
nil ->
template = Mirage.Settings.get_setting_by_name!("daily_template")
{:ok, note} =
create_note(%{
title: date_title,
content: template.value
})
note = create_daily_note()
[note]
end
note |> preload_note()
end
def create_daily_note() do
daily_title = today_title()
daily_content = Mirage.Settings.get_setting_by_name!("daily_template")
{:ok, note} =
create_note(%{
title: daily_title,
content: daily_content.value
})
note
end
def today_title() do
Timex.now() |> Timex.format!("{YYYY}-{0M}-{0D}")
end

6
lib/mirage_web/live/inbox_live/item_component.ex

@ -1,9 +1,3 @@
defmodule MirageWeb.InboxLive.ItemComponent do
use MirageWeb, :live_component
defp type_icon(:at), do: "bi-dice-4"
defp type_icon(:today), do: "bi-calendar-date"
defp type_icon(:untagged), do: "bi-tag"
defp type_icon(:unlinked), do: "bi-link-45deg"
defp type_icon(_), do: ""
end

2
lib/mirage_web/live/live_helpers.ex

@ -20,7 +20,7 @@ defmodule MirageWeb.LiveHelpers do
path = Keyword.fetch!(opts, :return_to)
modal_opts = [id: :modal, return_to: path, component: component, opts: opts]
live_component(socket, MirageWeb.ModalComponent, modal_opts)
socket |> live_component(MirageWeb.ModalComponent, modal_opts)
end
def with_user(socket, %{"user_id" => user_id} = _session) do

2
lib/mirage_web/live/search_live/index.html.leex

@ -15,7 +15,7 @@
<div class="results">
<%= if Enum.empty?(@results) do %>
<% else %>
<%= for {result, index} <- @results |> Enum.with_index() do %>
<%= for result <- @results do %>
<%= if result.type == "note" do %>
<%= live_component @socket, MirageWeb.SearchLive.SearchResultComponent, result: result, url: Routes.note_show_path(@socket, :show, result.id) %>
<% end %>

2
lib/mirage_web/templates/layout/root.html.leex

@ -15,7 +15,7 @@
<%= render "_sidebar.html", assigns %>
<% end %>
<header>
<header id="main-header">
<nav role="navigation">
<%= live_patch(@_s.header_title.value, to: "/") %> / <%= live_patch("Blog", to: "/blog") %> / <%= live_patch("Links", to: "/links") %> / <%= live_patch("Search", to: "/search") %>
<%= if not Mirage.Accounts.has_user? do %>

2
mix.exs

@ -1,7 +1,7 @@
defmodule Mirage.MixProject do
use Mix.Project
@version "0.90.0"
@version "0.91.0"
def project do
[

2
priv/repo/migrations/20210108235219_create_notes.exs

@ -8,7 +8,7 @@ defmodule Mirage.Repo.Migrations.CreateNotes do
add :content_html, :text
add :views, :integer, default: 0
add :viewed_at, :naive_datetime
add :list_id, :integer
timestamps()

9
priv/repo/migrations/20210111174337_add_settings_data.exs

@ -5,7 +5,14 @@ defmodule Mirage.Repo.Migrations.AddSettingsData do
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["user_tagline", "user_title", "footer_text", "header_title", "favicon", "daily_template"]
@settings [
"user_tagline",
"user_title",
"footer_text",
"header_title",
"favicon",
"daily_template"
]
def up do
Multi.new()

Loading…
Cancel
Save