Compare commits

..

1 commit
main ... i18n

Author SHA1 Message Date
c2ba192e6e
chore: bump to 0.1.4 2024-12-12 18:58:50 +02:00
9 changed files with 54 additions and 237 deletions

View file

@ -9,8 +9,12 @@ To start your Phoenix server:
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
## TODO
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
- [ ] Add tests
- [ ] Add a proper readme
- [ ] Add a calendar view
## Learn more
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix

View file

@ -436,7 +436,7 @@ defmodule ExmrWeb.CoreComponents do
~H"""
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<div>
<h1 class="text-lg font-semibold leading-none text-zinc-800 dark:text-zinc-200">
<h1 class="text-lg font-semibold leading-8 text-zinc-800 dark:text-zinc-200">
{render_slot(@inner_block)}
</h1>
<p :if={@subtitle != []} class="mt-2 text-sm leading-6 text-zinc-600 dark:text-zinc-100">

View file

@ -4,8 +4,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title>
{assigns[:page_title] || "ExMR"}
<.live_title suffix=" · Phoenix Framework">
{assigns[:page_title] || "Exmr"}
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script>
@ -48,7 +48,7 @@
href={~p"/users/register"}
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 dark:text-zinc-300 dark:hover:text-zinc-100"
>
{gettext("Register")}
Register
</.link>
</li>
<li>
@ -56,7 +56,7 @@
href={~p"/users/log_in"}
class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 dark:text-zinc-300 dark:hover:text-zinc-100"
>
{gettext("Log in")}
Log in
</.link>
</li>
<% end %>

View file

@ -12,8 +12,6 @@ defmodule ExmrWeb.ExamLive.Index do
|> assign(:sort_by, "date")
|> assign(:live_action, :index)
|> assign(exam: %{})
|> assign(events: Enum.group_by(Exams.list_exams(), & &1.date))
|> assign(current_month: Date.utc_today())
{:ok, socket}
end
@ -46,7 +44,6 @@ defmodule ExmrWeb.ExamLive.Index do
socket =
socket
|> assign(:exams, [exam | socket.assigns.exams])
|> assign(events: Enum.group_by(Exams.list_exams(), & &1.date))
{:noreply, socket}
end
@ -61,7 +58,6 @@ defmodule ExmrWeb.ExamLive.Index do
|> update(:exams, fn exams ->
Enum.reject(exams, fn l -> l.id == exam.id end)
end)
|> assign(events: Enum.group_by(Exams.list_exams(), & &1.date))
{:noreply, socket}
end

View file

@ -1,19 +1,12 @@
<.header>
{gettext("Listing Exams")}
<div>
<button
phx-click="sort"
phx-value-by="subject"
class="font-light text-xs md:text-sm lg:text-base"
>
<button phx-click="sort" phx-value-by="subject" class="font-light">
{gettext("Sort by Subject")}
</button>
<a class="invisible lg:visible">|</a>
<button
phx-click="sort"
phx-value-by="date"
class="font-light text-xs md:text-sm lg:text-base"
>
<a>|</a>
<button phx-click="sort" phx-value-by="date" class="font-light">
{gettext("Sort by Date")}
</button>
</div>
@ -29,10 +22,10 @@
<div class="divide-y">
<div :for={exam <- @exams} class="py-2 flex gap-2">
<div class="grow">
<div class="font-bold text-xs md:text-sm lg:text-base">{exam.subject}</div>
<div class="text-xs md:text-sm lg:text-base">
<div class="font-bold">{exam.subject}</div>
<div class="font-sm">
{exam.date} |
<b class="text-xs md:text-sm lg:text-base">
<b>
{case Date.diff(exam.date, Date.utc_today()) do
0 -> gettext("Today")
1 -> gettext("Tommorow")
@ -45,14 +38,14 @@
<button
phx-click="edit"
phx-value-id={exam.id}
class="bg-blue-500 hover:bg-blue-700 text-white font-bold p-1 text-xs md:text-sm lg:py-2 lg:px-3 rounded-md"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-3 rounded-md"
>
{gettext("Edit")}
</button>
<button
phx-click="remove"
phx-value-id={exam.id}
class="bg-red-500 hover:bg-red-700 text-white font-bold p-1 text-xs md:text-sm lg:py-2 lg:px-3 rounded-md"
class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 rounded-md"
>
{gettext("Remove")}
</button>
@ -69,53 +62,3 @@
patch={~p"/exams"}
/>
</.modal>
<div>
<!-- Navigation -->
<!-- <div class="flex justify-between mb-4"> -->
<!-- <button phx-click="previous_month" class="px-2 py-1 bg-blue-200">Previous</button> -->
<!-- <h2>{@current_month |> Date.to_string() |> String.replace("-", " ")}</h2> -->
<!-- <button phx-click="next_month" class="px-2 py-1 bg-blue-200">Next</button> -->
<!-- </div> -->
<!-- Calendar -->
<div class="grid grid-cols-7 gap-1" id="calendar-container" phx-update="replace">
<!-- Weekdays -->
<%= for weekday <- ~w(#{gettext("Sun")} #{gettext("Mon")} #{gettext("Tue")} #{gettext("Wed")} #{gettext("Thu")}
#{gettext("Fri")} #{gettext("Sat")}) do %>
<div class="font-bold text-center">{weekday}</div>
<% end %>
<!-- Empty spaces for previous month -->
<%= for _ <- 1..(Date.day_of_week(Date.new!(@current_month.year, @current_month.month, 1))) do %>
<div></div>
<% end %>
<!-- Days of the month -->
<%= for day <- 1..Date.days_in_month(@current_month) do %>
<% {:ok, date} = Date.new(@current_month.year, @current_month.month, day) %>
<div
id={"day-#{Date.to_string(date)}"}
class={[
"border rounded p-0.5 md:p-2 lg:p-3 w-full h-12 md:h-20 hover:scale-125 transition-transform ease-in-out duration-100",
@current_month == date &&
"bg-zinc-200 dark:bg-zinc-800 border-green-500 dark:border-green-300",
@current_month != date &&
"bg-white dark:bg-zinc-950 dark:border-zinc-400 "
]}
>
<div class="text-xs md:text-sm lg:text-base font-bold">{day}</div>
<!-- Render events for the current day -->
<%= if Map.has_key?(@events, date) do %>
<ul class="text-xs">
<%= for event <- @events[date] do %>
<li id={"event-#{event.id}"}>{event.subject}</li>
<% end %>
</ul>
<% end %>
</div>
<% end %>
</div>
</div>

View file

@ -4,7 +4,7 @@ defmodule Exmr.MixProject do
def project do
[
app: :exmr,
version: "0.2.2",
version: "0.1.4",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,

View file

@ -31,7 +31,7 @@ msgstr ""
msgid "Built using Phoenix LiveView, Ecto, and TailwindCSS by @vavakado"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:50
#: lib/exmr_web/live/exam_live/index.html.heex:44
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
@ -51,13 +51,13 @@ msgstr ""
msgid "Hang in there while we get back on track"
msgstr ""
#: lib/exmr_web/live/exam_live/index.ex:34
#: lib/exmr_web/live/exam_live/index.html.heex:23
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:16
#, elixir-autogen, elixir-format
msgid "New Exam"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:57
#: lib/exmr_web/live/exam_live/index.html.heex:51
#, elixir-autogen, elixir-format
msgid "Remove"
msgstr ""
@ -67,12 +67,12 @@ msgstr ""
msgid "Something went wrong!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:17
#: lib/exmr_web/live/exam_live/index.html.heex:10
#, elixir-autogen, elixir-format
msgid "Sort by Date"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:9
#: lib/exmr_web/live/exam_live/index.html.heex:5
#, elixir-autogen, elixir-format
msgid "Sort by Subject"
msgstr ""
@ -82,12 +82,12 @@ msgstr ""
msgid "Success!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:37
#: lib/exmr_web/live/exam_live/index.html.heex:31
#, elixir-autogen, elixir-format
msgid "Today"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Tomorrow"
msgid_plural "%{count} days left"
@ -212,59 +212,14 @@ msgstr ""
msgid "Saving..."
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:40
#: lib/exmr_web/live/exam_live/index.html.heex:34
#, elixir-autogen, elixir-format
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/live/exam_live/index.html.heex:38
#: lib/exmr_web/live/exam_live/index.html.heex:32
#, elixir-autogen, elixir-format
msgid "Tommorow"
msgstr ""
#: lib/exmr_web/components/layouts/root.html.heex:59
#, elixir-autogen, elixir-format
msgid "Log in"
msgstr ""
#: lib/exmr_web/components/layouts/root.html.heex:51
#, elixir-autogen, elixir-format
msgid "Register"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:85
#, elixir-autogen, elixir-format
msgid "Fri"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Mon"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:85
#, elixir-autogen, elixir-format
msgid "Sat"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Sun"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Thu"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Tue"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Wed"
msgstr ""

View file

@ -31,7 +31,7 @@ msgstr ""
msgid "Built using Phoenix LiveView, Ecto, and TailwindCSS by @vavakado"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:50
#: lib/exmr_web/live/exam_live/index.html.heex:44
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
@ -51,13 +51,13 @@ msgstr ""
msgid "Hang in there while we get back on track"
msgstr ""
#: lib/exmr_web/live/exam_live/index.ex:34
#: lib/exmr_web/live/exam_live/index.html.heex:23
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:16
#, elixir-autogen, elixir-format
msgid "New Exam"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:57
#: lib/exmr_web/live/exam_live/index.html.heex:51
#, elixir-autogen, elixir-format
msgid "Remove"
msgstr ""
@ -67,12 +67,12 @@ msgstr ""
msgid "Something went wrong!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:17
#: lib/exmr_web/live/exam_live/index.html.heex:10
#, elixir-autogen, elixir-format
msgid "Sort by Date"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:9
#: lib/exmr_web/live/exam_live/index.html.heex:5
#, elixir-autogen, elixir-format
msgid "Sort by Subject"
msgstr ""
@ -82,12 +82,12 @@ msgstr ""
msgid "Success!"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:37
#: lib/exmr_web/live/exam_live/index.html.heex:31
#, elixir-autogen, elixir-format
msgid "Today"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:33
#, elixir-autogen, elixir-format
msgid "Tomorrow"
msgid_plural "%{count} days left"
@ -212,59 +212,14 @@ msgstr ""
msgid "Saving..."
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:40
#: lib/exmr_web/live/exam_live/index.html.heex:34
#, elixir-autogen, elixir-format
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] ""
msgstr[1] ""
#: lib/exmr_web/live/exam_live/index.html.heex:38
#: lib/exmr_web/live/exam_live/index.html.heex:32
#, elixir-autogen, elixir-format, fuzzy
msgid "Tommorow"
msgstr ""
#: lib/exmr_web/components/layouts/root.html.heex:59
#, elixir-autogen, elixir-format
msgid "Log in"
msgstr ""
#: lib/exmr_web/components/layouts/root.html.heex:51
#, elixir-autogen, elixir-format
msgid "Register"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:85
#, elixir-autogen, elixir-format
msgid "Fri"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Mon"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:85
#, elixir-autogen, elixir-format
msgid "Sat"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Sun"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Thu"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Tue"
msgstr ""
#: lib/exmr_web/live/exam_live/index.html.heex:84
#, elixir-autogen, elixir-format
msgid "Wed"
msgstr ""

View file

@ -13,7 +13,7 @@ msgid ""
msgstr ""
"Project-Id-Version: unnamed project\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-12-23 19:01+0200\n"
"PO-Revision-Date: 2024-12-12 18:19+0200\n"
"Last-Translator: Vladimir Rubin <vavakado@proton.me>\n"
"Language-Team: Russian\n"
"Language: ru\n"
@ -42,7 +42,7 @@ msgstr ""
"Создано с использованием Phoenix LiveView, Ecto и TailwindCSS в исполнении "
"@vavakado"
#: lib/exmr_web/live/exam_live/index.html.heex:50
#: lib/exmr_web/live/exam_live/index.html.heex:44
msgid "Edit"
msgstr "Изменить"
@ -58,12 +58,12 @@ msgstr "Экзамены"
msgid "Hang in there while we get back on track"
msgstr "Держитесь, пока мы не вернемся в строй"
#: lib/exmr_web/live/exam_live/index.ex:34
#: lib/exmr_web/live/exam_live/index.html.heex:23
#: lib/exmr_web/live/exam_live/index.ex:32
#: lib/exmr_web/live/exam_live/index.html.heex:16
msgid "New Exam"
msgstr "Новый экзамен"
#: lib/exmr_web/live/exam_live/index.html.heex:57
#: lib/exmr_web/live/exam_live/index.html.heex:51
msgid "Remove"
msgstr "Удалить"
@ -71,11 +71,11 @@ msgstr "Удалить"
msgid "Something went wrong!"
msgstr "Что-то пошло не так!"
#: lib/exmr_web/live/exam_live/index.html.heex:17
#: lib/exmr_web/live/exam_live/index.html.heex:10
msgid "Sort by Date"
msgstr "Сортировать по дате"
#: lib/exmr_web/live/exam_live/index.html.heex:9
#: lib/exmr_web/live/exam_live/index.html.heex:5
msgid "Sort by Subject"
msgstr "Сортировать по предмету"
@ -83,11 +83,11 @@ msgstr "Сортировать по предмету"
msgid "Success!"
msgstr "Успех!"
#: lib/exmr_web/live/exam_live/index.html.heex:37
#: lib/exmr_web/live/exam_live/index.html.heex:31
msgid "Today"
msgstr "Сегодня"
#: lib/exmr_web/live/exam_live/index.html.heex:39
#: lib/exmr_web/live/exam_live/index.html.heex:33
msgid "Tomorrow"
msgid_plural "%{count} days left"
msgstr[0] "%{count} день остался"
@ -194,49 +194,13 @@ msgstr "Сохранить экзамен"
msgid "Saving..."
msgstr "Сохранение..."
#: lib/exmr_web/live/exam_live/index.html.heex:40
#: lib/exmr_web/live/exam_live/index.html.heex:34
msgid "Yesterday"
msgid_plural "%{count} days passed"
msgstr[0] "%{count} день прошёл"
msgstr[1] "%{count} дня прошло"
msgstr[2] "%{count} дней прошло"
#: lib/exmr_web/live/exam_live/index.html.heex:38
#: lib/exmr_web/live/exam_live/index.html.heex:32
msgid "Tommorow"
msgstr "Завтра"
#: lib/exmr_web/components/layouts/root.html.heex:59
msgid "Log in"
msgstr "Зайти в аккаунт"
#: lib/exmr_web/components/layouts/root.html.heex:51
msgid "Register"
msgstr "Зарегестрироваться"
#: lib/exmr_web/live/exam_live/index.html.heex:85
msgid "Fri"
msgstr "Пт"
#: lib/exmr_web/live/exam_live/index.html.heex:84
msgid "Mon"
msgstr "Пн"
#: lib/exmr_web/live/exam_live/index.html.heex:85
msgid "Sat"
msgstr "Сб"
#: lib/exmr_web/live/exam_live/index.html.heex:84
msgid "Sun"
msgstr "Вс"
#: lib/exmr_web/live/exam_live/index.html.heex:84
msgid "Thu"
msgstr "Чт"
#: lib/exmr_web/live/exam_live/index.html.heex:84
msgid "Tue"
msgstr "Вт"
#: lib/exmr_web/live/exam_live/index.html.heex:84
msgid "Wed"
msgstr "Ср"