Skip to content

Commit

Permalink
check data
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek committed Dec 18, 2024
1 parent 96b9684 commit f4f9f14
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 16 deletions.
11 changes: 6 additions & 5 deletions assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,17 @@ a .bi {

/* LiveView specific classes for your customizations */

// similar to .phx-connected but also works when javascript is disabled
div[data-phx-session] {
height: 100%;
width: 100%;
}

.phx-click-loading {
opacity: 0.5;
transition: opacity 1s ease-out;
}

.phx-connected {
height: 100%;
width: 100%;
}

.phx-disconnected {
cursor: wait;
}
Expand Down
7 changes: 6 additions & 1 deletion lib/mindwendel_web/live/brainstorming_live/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ defmodule MindwendelWeb.BrainstormingLive.Show do

@impl true
def handle_event("brainstormings_from_local_storage", brainstormings_stored, socket) do
{:noreply, assign(socket, :brainstormings_stored, brainstormings_stored)}
valid_stored_brainstormings =
if is_list(brainstormings_stored),
do: brainstormings_stored |> Enum.filter(&valid_stored_brainstorming?/1),
else: []

{:noreply, assign(socket, :brainstormings_stored, valid_stored_brainstormings)}
end

@impl true
Expand Down
7 changes: 7 additions & 0 deletions lib/mindwendel_web/live/live_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,11 @@ defmodule MindwendelWeb.LiveHelpers do
{:error, _} -> iso8601
end
end

def valid_stored_brainstorming?(brainstorming) do
case Ecto.UUID.cast(brainstorming["id"]) do
{:ok, _} -> brainstorming["last_accessed_at"] && brainstorming["name"]
:error -> false
end
end
end
7 changes: 6 additions & 1 deletion lib/mindwendel_web/live/start_live/home.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ defmodule MindwendelWeb.StartLive.Home do

@impl true
def handle_event("brainstormings_from_local_storage", brainstormings_stored, socket) do
{:noreply, assign(socket, :brainstormings_stored, brainstormings_stored)}
valid_stored_brainstormings =
if is_list(brainstormings_stored),
do: brainstormings_stored |> Enum.filter(&valid_stored_brainstorming?/1),
else: []

{:noreply, assign(socket, :brainstormings_stored, valid_stored_brainstormings)}
end
end
6 changes: 3 additions & 3 deletions priv/gettext/de/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ msgstr "Wie können wir ..."
msgid "Ready?"
msgstr "Fertig?"

#: lib/mindwendel_web/live/brainstorming_live/show.ex:192
#: lib/mindwendel_web/live/brainstorming_live/show.ex:197
#, elixir-autogen, elixir-format
msgid "%{name} - Edit"
msgstr "%{name} - Editieren"

#: lib/mindwendel_web/live/brainstorming_live/show.ex:169
#: lib/mindwendel_web/live/brainstorming_live/show.ex:174
#, elixir-autogen, elixir-format
msgid "%{name} - New Idea"
msgstr "%{name} - Neue Idee"
Expand Down Expand Up @@ -385,7 +385,7 @@ msgstr "Löschen"
msgid "Type the label name"
msgstr "Gebe dem Label einen Namen"

#: lib/mindwendel_web/live/brainstorming_live/show.ex:179
#: lib/mindwendel_web/live/brainstorming_live/show.ex:184
#, elixir-autogen, elixir-format, fuzzy
msgid "%{name} - New Lane"
msgstr "%{name} - Neue Idee"
Expand Down
6 changes: 3 additions & 3 deletions priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ msgstr ""
msgid "Ready?"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:192
#: lib/mindwendel_web/live/brainstorming_live/show.ex:197
#, elixir-autogen, elixir-format
msgid "%{name} - Edit"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:169
#: lib/mindwendel_web/live/brainstorming_live/show.ex:174
#, elixir-autogen, elixir-format
msgid "%{name} - New Idea"
msgstr ""
Expand Down Expand Up @@ -384,7 +384,7 @@ msgstr ""
msgid "Type the label name"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:179
#: lib/mindwendel_web/live/brainstorming_live/show.ex:184
#, elixir-autogen, elixir-format
msgid "%{name} - New Lane"
msgstr ""
Expand Down
6 changes: 3 additions & 3 deletions priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ msgstr ""
msgid "Ready?"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:192
#: lib/mindwendel_web/live/brainstorming_live/show.ex:197
#, elixir-autogen, elixir-format
msgid "%{name} - Edit"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:169
#: lib/mindwendel_web/live/brainstorming_live/show.ex:174
#, elixir-autogen, elixir-format
msgid "%{name} - New Idea"
msgstr ""
Expand Down Expand Up @@ -385,7 +385,7 @@ msgstr ""
msgid "Type the label name"
msgstr ""

#: lib/mindwendel_web/live/brainstorming_live/show.ex:179
#: lib/mindwendel_web/live/brainstorming_live/show.ex:184
#, elixir-autogen, elixir-format, fuzzy
msgid "%{name} - New Lane"
msgstr ""
Expand Down

0 comments on commit f4f9f14

Please sign in to comment.