From 4a30b6136d4a42bcdec51ec71a01702307a58693 Mon Sep 17 00:00:00 2001 From: Jerod Santo Date: Thu, 19 Dec 2024 12:13:22 -0600 Subject: [PATCH] Improve social handle setups - Add Bluesky - Change "Twitter" to "X" (ugh) --- assets/app/layout/show.scss | 7 ++- .../static/images/icons/icon-bsky-black.svg | 4 ++ assets/static/images/icons/icon-bsky.svg | 7 +++ assets/static/images/icons/icon-x-black.svg | 12 +++++ assets/static/images/icons/icon-x.svg | 12 +++++ .../static/images/icons/podcast_icon-bsky.png | Bin 0 -> 1088 bytes assets/static/images/icons/podcast_icon-x.png | Bin 0 -> 1727 bytes lib/changelog/schema/person.ex | 6 ++- lib/changelog/schema/podcast/podcast.ex | 5 +- lib/changelog_web/helpers/shared_helpers.ex | 10 ++++ .../templates/admin/person/_form.html.eex | 8 ++- .../templates/admin/podcast/_form.html.heex | 15 ++++-- .../{profile.html.eex => profile.html.heex} | 49 +++++++++++------- .../templates/layout/_footer.html.heex | 42 +++++++++------ .../templates/layout/_header.html.heex | 2 +- .../person/{join.html.eex => join.html.heex} | 43 +++++++++------ .../podcast/_subscribe_buttons.html.heex | 5 +- .../podcast/_subscribe_tooltip.html.heex | 11 ++-- lib/changelog_web/views/person_view.ex | 27 ++++++---- ...add_bsky_handle_to_podcasts_and_people.exs | 16 ++++++ 20 files changed, 202 insertions(+), 79 deletions(-) create mode 100644 assets/static/images/icons/icon-bsky-black.svg create mode 100644 assets/static/images/icons/icon-bsky.svg create mode 100644 assets/static/images/icons/icon-x-black.svg create mode 100644 assets/static/images/icons/icon-x.svg create mode 100644 assets/static/images/icons/podcast_icon-bsky.png create mode 100644 assets/static/images/icons/podcast_icon-x.png rename lib/changelog_web/templates/home/{profile.html.eex => profile.html.heex} (76%) rename lib/changelog_web/templates/person/{join.html.eex => join.html.heex} (76%) create mode 100644 priv/repo/migrations/20241219173430_add_bsky_handle_to_podcasts_and_people.exs diff --git a/assets/app/layout/show.scss b/assets/app/layout/show.scss index 1b795bb30d..65680cdafe 100644 --- a/assets/app/layout/show.scss +++ b/assets/app/layout/show.scss @@ -296,8 +296,11 @@ &--mastodon { background-image: url("../images/icons/podcast_icon-mastodon.png"); } - &--twitter { - background-image: url("../images/icons/podcast_icon-twitter.png"); + &--bsky { + background-image: url("../images/icons/podcast_icon-bsky.png"); + } + &--x { + background-image: url("../images/icons/podcast_icon-x.png"); } } } diff --git a/assets/static/images/icons/icon-bsky-black.svg b/assets/static/images/icons/icon-bsky-black.svg new file mode 100644 index 0000000000..aac10ab3c4 --- /dev/null +++ b/assets/static/images/icons/icon-bsky-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/static/images/icons/icon-bsky.svg b/assets/static/images/icons/icon-bsky.svg new file mode 100644 index 0000000000..0e0702c776 --- /dev/null +++ b/assets/static/images/icons/icon-bsky.svg @@ -0,0 +1,7 @@ + + + + diff --git a/assets/static/images/icons/icon-x-black.svg b/assets/static/images/icons/icon-x-black.svg new file mode 100644 index 0000000000..1e694a9ab1 --- /dev/null +++ b/assets/static/images/icons/icon-x-black.svg @@ -0,0 +1,12 @@ + + + diff --git a/assets/static/images/icons/icon-x.svg b/assets/static/images/icons/icon-x.svg new file mode 100644 index 0000000000..c0b2d810bf --- /dev/null +++ b/assets/static/images/icons/icon-x.svg @@ -0,0 +1,12 @@ + + + diff --git a/assets/static/images/icons/podcast_icon-bsky.png b/assets/static/images/icons/podcast_icon-bsky.png new file mode 100644 index 0000000000000000000000000000000000000000..18289194931109a17b5d89e08493ffb8894e0d5d GIT binary patch literal 1088 zcmV-G1i$-wr$(Cu5F`E_Qc7ed!~Ci#8^%V*Y%B+2$6P^pbxTEkQhxFs)N$PQ$T7Aq?RGqb7fv}WR z0^d&ePV95T1*t^{%iIG{x5bQ%shO(al-|7EG-^=A){D zbM`}n|{6$Yz9W z|JT{(?SC`PqTtIr3vBS_*ub`L?IkF!f-$d-wkViZQ3GSriU7W=|0MK+RmWfh20Xih z59h%O12*EHv~i}u78iD~EO_x@SfN&chXx8R=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m?QJ{!pouy4D0FN)R83A!MvpLxC26KN!6+#yaSHWoYioAag@6zp!qmaV z#l<2}T3Sj4B#gt8=Ns)c&-(6==kB^TgCnrbuba!`S z$pS5*dE?Us;$f=rMtzAbfOmBq5KB>?)BRQC(dfC)l~Lxw)xlb7qCjeFJ5f{UckB`5WFiNBCbly|Ela$zJ$~Zh1 z#>dBXPfbnD|0ev;d+J=S<>h7bUMwsu*w4i4I}gSS3JP=&F+U*w4%7hvR#sNxw${wd zjQJ?EwYBNF5WBm(b9ES~3xPigT|qklVkSYHpP%bxgo^g|_7CmUxxKw5tMW@WkaKyz zNRzuKh*%Bv8q3JYNPsRL|2{2VKqHA> zK*GSRegg2&tZbm3FeU~so&f&x>%`+^pC&UsJU2HN*~WY(CGsDA0+j`*MO&BO0kEq~y5OTS;H{kU%r{{@Y6 V_z2Af9~}Sy002ovPDHLkV1fXcO1l66 literal 0 HcmV?d00001 diff --git a/lib/changelog/schema/person.ex b/lib/changelog/schema/person.ex index c3b2f9e8ad..946dba47fa 100644 --- a/lib/changelog/schema/person.ex +++ b/lib/changelog/schema/person.ex @@ -54,6 +54,7 @@ defmodule Changelog.Person do field :linkedin_handle, :string field :mastodon_handle, :string field :twitter_handle, :string + field :bsky_handle, :string field :slack_id, :string field :zulip_id, :string field :website, :string @@ -215,7 +216,7 @@ defmodule Changelog.Person do def admin_insert_changeset(person, attrs \\ %{}) do allowed = ~w(name email handle github_handle linkedin_handle mastodon_handle - twitter_handle bio website location admin host editor + twitter_handle bsky_handle bio website location admin host editor public_profile approved)a changeset_with_allowed_attrs(person, attrs, allowed) @@ -232,7 +233,7 @@ defmodule Changelog.Person do def insert_changeset(person, attrs \\ %{}) do allowed = ~w(name email handle github_handle linkedin_handle mastodon_handle - twitter_handle bio website location public_profile)a + twitter_handle bsky_handle bio website location public_profile)a changeset_with_allowed_attrs(person, attrs, allowed) end @@ -271,6 +272,7 @@ defmodule Changelog.Person do |> unique_constraint(:linkedin_handle) |> unique_constraint(:mastodon_handle) |> unique_constraint(:twitter_handle) + |> unique_constraint(:bsky_handle) end defp validate_handle_allowed(changeset) do diff --git a/lib/changelog/schema/podcast/podcast.ex b/lib/changelog/schema/podcast/podcast.ex index cb60917bd0..925f9e86cb 100644 --- a/lib/changelog/schema/podcast/podcast.ex +++ b/lib/changelog/schema/podcast/podcast.ex @@ -35,6 +35,7 @@ defmodule Changelog.Podcast do field :mastodon_handle, :string field :mastodon_token, :string field :twitter_handle, :string + field :bsky_handle, :string field :apple_url, :string field :spotify_url, :string field :riverside_url, :string @@ -79,6 +80,7 @@ defmodule Changelog.Podcast do status: :publishing, is_meta: true, twitter_handle: "changelog", + bsky_handle: "changelog.com", mastodon_handle: "changelog@changelog.social", mastodon_token: nil, welcome: "Your one-stop shop for all Changelog podcasts", @@ -105,6 +107,7 @@ defmodule Changelog.Podcast do is_meta: true, vanity_domain: "https://changelog.fm", twitter_handle: "changelog", + bsky_handle: "changelog.com", mastodon_handle: "changelog@changelog.social", mastodon_token: nil, welcome: "Software's best weekly news brief, deep technical interviews & talk show", @@ -147,7 +150,7 @@ defmodule Changelog.Podcast do podcast |> cast( attrs, - ~w(name slug status vanity_domain schedule_note welcome description extended_description keywords mastodon_handle mastodon_token twitter_handle apple_url spotify_url riverside_url youtube_url clips_url zulip_url recorded_live partner position)a + ~w(name slug status vanity_domain schedule_note welcome description extended_description keywords mastodon_handle mastodon_token twitter_handle bsky_handle apple_url spotify_url riverside_url youtube_url clips_url zulip_url recorded_live partner position)a ) |> validate_required([:name, :slug, :status]) |> validate_format(:vanity_domain, Regexp.http(), message: Regexp.http_message()) diff --git a/lib/changelog_web/helpers/shared_helpers.ex b/lib/changelog_web/helpers/shared_helpers.ex index cab60dff6e..7f02a0949f 100644 --- a/lib/changelog_web/helpers/shared_helpers.ex +++ b/lib/changelog_web/helpers/shared_helpers.ex @@ -28,6 +28,11 @@ defmodule ChangelogWeb.Helpers.SharedHelpers do def action_name(conn), do: Controller.action_name(conn) + def bsky_url(nil), do: "" + def bsky_url(%{bsky_handle: nil}), do: "" + def bsky_url(%{bsky_handle: handle}), do: bsky_url(handle) + def bsky_url(handle), do: "https://bsky.app/profile/#{handle}" + def comma_separated(number) do number |> Integer.to_charlist() @@ -201,6 +206,11 @@ defmodule ChangelogWeb.Helpers.SharedHelpers do end end + def x_url(nil), do: "" + def x_url(%{twitter_handle: nil}), do: "" + def x_url(%{twitter_handle: handle}), do: x_url(handle) + def x_url(handle) when is_binary(handle), do: "https://x.com/#{handle}" + def word_count(nil), do: 0 def word_count(text) when is_binary(text) do diff --git a/lib/changelog_web/templates/admin/person/_form.html.eex b/lib/changelog_web/templates/admin/person/_form.html.eex index bb6dcc05b2..cdd2efa920 100644 --- a/lib/changelog_web/templates/admin/person/_form.html.eex +++ b/lib/changelog_web/templates/admin/person/_form.html.eex @@ -27,7 +27,7 @@ -
+
<%= label(f, :github_handle, "GitHub Handle") %> <%= text_input(f, :github_handle, placeholder: "gracehopper", autocapitalize: "none", mask: "slug") %> @@ -45,6 +45,12 @@ <%= text_input(f, :mastodon_handle, placeholder: "gracehopper@changelog.social", autocapitalize: "none", mask: "slug") %> <%= AdminHelpers.error_message(f, :mastodon_handle) %>
+ +
+ <%= label(f, :bsky_handle, "Bluesky Handle") %> + <%= text_input(f, :bsky_handle, placeholder: "gracehopper", autocapitalize: "none", mask: "slug") %> + <%= AdminHelpers.error_message(f, :bsky_handle) %> +
diff --git a/lib/changelog_web/templates/admin/podcast/_form.html.heex b/lib/changelog_web/templates/admin/podcast/_form.html.heex index 4efb7d6689..1674abac14 100644 --- a/lib/changelog_web/templates/admin/podcast/_form.html.heex +++ b/lib/changelog_web/templates/admin/podcast/_form.html.heex @@ -36,15 +36,22 @@ <%= AdminHelpers.error_message(f, :twitter_handle) %>
+
+ <%= label(f, :bsky_handle, "On Bluesky") %> + <%= text_input(f, :bsky_handle, placeholder: "changelog.com") %> +
+
+ +
<%= label(f, :mastodon_handle, "On Mastodon") %> <%= text_input(f, :mastodon_handle, placeholder: "changelog@changelog.social") %>
-
-
- <%= label(f, :mastodon_token, "Mastodon API Token") %> - <%= text_input(f, :mastodon_token) %> +
+ <%= label(f, :mastodon_token, "Mastodon API Token") %> + <%= text_input(f, :mastodon_token) %> +
diff --git a/lib/changelog_web/templates/home/profile.html.eex b/lib/changelog_web/templates/home/profile.html.heex similarity index 76% rename from lib/changelog_web/templates/home/profile.html.eex rename to lib/changelog_web/templates/home/profile.html.heex index 49938d4f44..74bf3fe569 100644 --- a/lib/changelog_web/templates/home/profile.html.eex +++ b/lib/changelog_web/templates/home/profile.html.heex @@ -15,13 +15,13 @@
-
+
<%= text_input(f, :name, placeholder: "Grace Hopper") %> <%= PublicHelpers.error_message(f, :name) %>
-
+
<%= text_input(f, :handle, placeholder: "gracehopper", autocapitalize: "none") %> <%= PublicHelpers.error_message(f, :handle) %> @@ -29,7 +29,7 @@
-
+
<%= file_input(f, :avatar) %> <%= PublicHelpers.error_message(f, :avatar) %> @@ -38,12 +38,12 @@
<%= SharedHelpers.maybe_lazy_image(@conn, PersonView.avatar_url(@changeset.data), @changeset.data.name, width: 67, height: 67) %> -

<%= if @changeset.data.avatar, do: "This image was uploaded to changelog.com", else: "This image is loaded from Gravatar" %> +

<%= if @changeset.data.avatar, do: "This image was uploaded to changelog.com", else: "This image is loaded from Gravatar" %>

-
-
+
+
github.com/ @@ -52,27 +52,38 @@ <%= PublicHelpers.error_message(f, :github_handle) %>
-
- +
+ +
+ linked.com/in/ + <%= text_input(f, :linkedin_handle, placeholder: "gracehopper", autocapitalize: "none") %> +
+ <%= PublicHelpers.error_message(f, :linkedin_handle) %> +
+
+ +
+
+
- twitter.com/ + x.com/ <%= text_input(f, :twitter_handle, placeholder: "gracehopper", autocapitalize: "none") %>
<%= PublicHelpers.error_message(f, :twitter_handle) %>
-
- +
+
- linked.com/in/ - <%= text_input(f, :linkedin_handle, placeholder: "gracehopper", autocapitalize: "none") %> + bsky.app/profile/ + <%= text_input(f, :bsky_handle, placeholder: "gracehopper", autocapitalize: "none") %>
- <%= PublicHelpers.error_message(f, :linkedin_handle) %> + <%= PublicHelpers.error_message(f, :bsky_handle) %>
-
+
@ @@ -81,13 +92,13 @@ <%= PublicHelpers.error_message(f, :mastodon_handle) %>
-
+
<%= text_input(f, :location, placeholder: "New York, New York") %> <%= PublicHelpers.error_message(f, :location) %>
-
+
<%= text_input(f, :website, placeholder: "https://gracehopper.com", autocapitalize: "none") %> <%= PublicHelpers.error_message(f, :website) %> @@ -95,7 +106,7 @@
-
+
<%= textarea(f, :bio) %> <%= PublicHelpers.error_message(f, :bio) %> @@ -104,7 +115,7 @@
-
+
<%= if Changelog.Policies.Person.profile(@current_user, @current_user) do %>