<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Phoenix LiveView on Poeticoding</title><link>https://www.poeticoding.com/category/phoenix/phoenix-liveview/</link><description>Recent content in Phoenix LiveView on Poeticoding</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 23 Nov 2021 16:16:52 +0000</lastBuildDate><atom:link href="https://www.poeticoding.com/category/phoenix/phoenix-liveview/index.xml" rel="self" type="application/rss+xml"/><item><title>Phoenix LiveView LiveComponents</title><link>https://www.poeticoding.com/phoenix-liveview-livecomponents/</link><pubDate>Tue, 23 Nov 2021 16:09:36 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-livecomponents/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/U2D2woBthcc" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;a href="https://www.poeticoding.com/introductory-phoenix-liveview-course/">&lt;strong>Course Index page&lt;/strong>&lt;/a>&lt;/p>
&lt;h2 id="code">Code&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/poeticoding/poeticoins/tree/live-component" target="_blank" rel="noopener">&lt;code>live-component&lt;/code> branch&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/poeticoding/poeticoins/pull/18" target="_blank" rel="noopener">Pull Request&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/poeticoding/poeticoins/blob/live-component/lib/poeticoins_web/live/product_component.ex" target="_blank" rel="noopener">&lt;code>product_component.ex&lt;/code>&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="links">Links&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html" target="_blank" rel="noopener">Phoenix.LiveComponent&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Helpers.html#live_component/4" target="_blank" rel="noopener">&lt;code>live_component/4&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveComponent.html#module-stateful-components-life-cycle" target="_blank" rel="noopener">Stateful components&lt;/a>&lt;/li>
&lt;/ul>
&lt;hr>
&lt;p>We&amp;rsquo;ve just started to build our &lt;a href="https://github.com/poeticoding/poeticoins/blob/dashboard-ui/lib/poeticoins_web/live/crypto_dashboard_live.ex" target="_blank" rel="noopener">&lt;code>CryptoDashboardLive&lt;/code> view&lt;/a>, and we already have the feeling that the we are piling up a lot of code into the single &lt;code>CryptoDashboardLive&lt;/code> module. It&amp;rsquo;s not just about the template in the &lt;a href="https://github.com/poeticoding/poeticoins/blob/dashboard-ui/lib/poeticoins_web/live/crypto_dashboard_live.ex#L11" target="_blank" rel="noopener">&lt;code>render/1&lt;/code>&lt;/a> function, we could easily move it into a &lt;code>.leex&lt;/code> file. The risk is to find us with a single massive live view module which handles every aspect of our page, making che code hard to read and maintain. This page already has different parts with different responsibilities, for example: product cards where each one shows its product price, a toolbar with a dropdown to add products to the dashboard&amp;hellip;&lt;/p></description></item><item><title>A nice Dashboard UI</title><link>https://www.poeticoding.com/a-nice-dashboard-ui/</link><pubDate>Tue, 23 Nov 2021 15:35:40 +0000</pubDate><guid>https://www.poeticoding.com/a-nice-dashboard-ui/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/DVIrfx0CiLc" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;a href="https://www.poeticoding.com/introductory-phoenix-liveview-course/">Course Index page&lt;/a>&lt;/p>
&lt;h2 id="code">Code&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/poeticoding/poeticoins/tree/dashboard-ui" target="_blank" rel="noopener">&lt;em>dashboard-ui&lt;/em> repo&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/poeticoding/poeticoins/blob/dashboard-ui/assets/css/poeticoins.scss" target="_blank" rel="noopener">&lt;code>assets/css/poeticoins.scss&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://raw.githubusercontent.com/poeticoding/poeticoins/d7978efc38d2b04d4ff67cfffb44dc1f1721313e/assets/static/images/background.svg" target="_blank" rel="noopener">&lt;code>assets/static/images/background.svg&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://raw.githubusercontent.com/poeticoding/poeticoins/d7978efc38d2b04d4ff67cfffb44dc1f1721313e/assets/static/images/cryptos/btc.svg" target="_blank" rel="noopener">&lt;code>assets/static/images/cryptos/btc.svg&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://raw.githubusercontent.com/poeticoding/poeticoins/d7978efc38d2b04d4ff67cfffb44dc1f1721313e/assets/static/images/cryptos/eth.svg" target="_blank" rel="noopener">&lt;code>assets/static/images/cryptos/eth.svg&lt;/code>&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://raw.githubusercontent.com/poeticoding/poeticoins/d7978efc38d2b04d4ff67cfffb44dc1f1721313e/assets/static/images/cryptos/ltc.svg" target="_blank" rel="noopener">&lt;code>assets/static/images/cryptos/ltc.svg&lt;/code>&lt;/a>&lt;/li>
&lt;/ul>
&lt;hr>
&lt;p>Before going on with LiveComponents and other topics, let&amp;rsquo;s spend a few minutes on our UI. At the moment products and trades are rendered in a table, using the default &lt;code>phoenix.css&lt;/code>.&lt;/p></description></item><item><title>Intro to Poeticoins Elixir application</title><link>https://www.poeticoding.com/phoenix-liveview-intro-to-poeticoins-elixir-application/</link><pubDate>Sat, 27 Mar 2021 11:51:14 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-intro-to-poeticoins-elixir-application/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/QJszKVQLZ7Y" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;a href="https://www.poeticoding.com/introductory-phoenix-liveview-course/">Course Index page&lt;/a>&lt;/p>
&lt;p>&lt;strong>Poeticoins GitHub repository&lt;/strong>: &lt;a href="https://github.com/poeticoding/poeticoins/tree/cicd-gh-gigalixir" target="_blank" rel="noopener">poeticoding/poeticoins&lt;/a>&lt;/p></description></item><item><title>Application Design</title><link>https://www.poeticoding.com/phoenix-liveview-application-design/</link><pubDate>Tue, 23 Mar 2021 18:43:56 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-application-design/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/DOYMep5xXp4" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;a href="https://www.poeticoding.com/introductory-phoenix-liveview-course/">Course Index page&lt;/a>&lt;/p>
&lt;p>In this course we&amp;rsquo;ll build a Phoenix LiveView app (called &lt;a href="https://coins.poeticoding.com/">Poeticoins&lt;/a>) that gets real-time trades from multiple cryptocurrency exchanges and, with LiveView, it displays prices, and other data, on an interactive dashboard.&lt;/p>
&lt;!-- BROKEN IMAGE: https://cdn.fs.teachablecdn.com/resize=width:2500/iMyDdFqTtuOtrc7bJJV6 | app_goal.png -->
&lt;p>Since the dashboard just shows the most recent data, we won&amp;rsquo;t need any database. We&amp;rsquo;ll see how to use Elixir processes to temporarily keep all we need in memory.&lt;/p></description></item><item><title>Intro to Cryptocurrency Exchanges</title><link>https://www.poeticoding.com/phoenix-liveview-intro-to-cryptocurrency-exchanges/</link><pubDate>Tue, 23 Mar 2021 16:22:16 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-intro-to-cryptocurrency-exchanges/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/tu40uo7Jq7g" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;a href="https://www.poeticoding.com/introductory-phoenix-liveview-course/">Course Index page&lt;/a>&lt;/p>
&lt;p>I&amp;rsquo;ve decided to build this Phoenix LiveView course around a Cryptocurrency dashboard example because Cryptocurrency Exchanges are a fantastic, often public, source of realtime data. Don&amp;rsquo;t be scared if you don&amp;rsquo;t know anything about cryptocurrencies or exchanges, I&amp;rsquo;m going to explain everything we need to start playing with this data.&lt;/p></description></item><item><title>LiveView click event and offsetX, offsetY coordinates</title><link>https://www.poeticoding.com/liveview-click-event-and-offsetx-offsety-coordinates/</link><pubDate>Thu, 19 Mar 2020 17:05:47 +0000</pubDate><guid>https://www.poeticoding.com/liveview-click-event-and-offsetx-offsety-coordinates/</guid><description>&lt;p>&lt;a href="https://www.poeticoding.com/how-to-setup-phoenix-liveview/">Phoenix LiveView&lt;/a> plays fantastically well with SVG elements, making really easy to render dynamic images, without writing any JavaScript code.&lt;/p>
&lt;p>There are different &lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-bindings" target="_blank" rel="noopener">bindings&lt;/a> we can use to register and react to user interaction, one of these is &lt;code>phx-click&lt;/code>. By adding &lt;code>phx-click=&amp;quot;clicked&amp;quot;&lt;/code> attribute to an element in our LiveView, when user clicks the element, a &lt;code>&amp;quot;clicked&amp;quot;&lt;/code> event is sent to the LiveView process.&lt;/p></description></item><item><title>Phoenix LiveView JavaScript Hooks and Select2</title><link>https://www.poeticoding.com/phoenix-liveview-javascript-hooks-and-select2/</link><pubDate>Wed, 05 Feb 2020 11:48:10 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-javascript-hooks-and-select2/</guid><description>&lt;p>&lt;a href="https://www.poeticoding.com/using-select2-with-phoenix-liveview/">We&amp;rsquo;ve already played with Select2 and LiveView&lt;/a>, it was before the release of &lt;a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-js-interop-and-client-controlled-dom" target="_blank" rel="noopener">LiveView JS Hooks&lt;/a>. To make select2 work with LiveView we had to listen to &lt;code>phx:update&lt;/code> generic javascript events, re-initialize select2 and use a workaround to push events from the browser to LiveView.&lt;/p></description></item><item><title>Understanding Phoenix LiveView: build a Gallery app</title><link>https://www.poeticoding.com/understanding-liveview-build-a-gallery-app/</link><pubDate>Wed, 20 Nov 2019 17:50:13 +0000</pubDate><guid>https://www.poeticoding.com/understanding-liveview-build-a-gallery-app/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/P5TvNf65LLw" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;strong>Understanding Phoenix LiveView&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.poeticoding.com/how-to-setup-phoenix-liveview/">Setup&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.poeticoding.com/the-primitives-of-phoenix-liveview/">The Primitives&lt;/a>&lt;/li>
&lt;li>Building a Gallery app (this article)&lt;/li>
&lt;/ul>
&lt;p>In the previous articles we&amp;rsquo;ve seen &lt;a href="https://www.poeticoding.com/how-to-setup-phoenix-liveview/">how to setup Phoenix LiveView&lt;/a> and &lt;a href="https://www.poeticoding.com/the-primitives-of-phoenix-liveview/">built a counter&lt;/a> (which is like the &amp;ldquo;Hello World&amp;rdquo; code example in the LiveView world). We’ve also taken a look at the &lt;a href="https://www.poeticoding.com/the-primitives-of-phoenix-liveview/">live-cycle&lt;/a>, inspecting websocket messages, having a glimpse of how the things work under the hood.&lt;/p></description></item><item><title>The Primitives of Phoenix LiveView</title><link>https://www.poeticoding.com/the-primitives-of-phoenix-liveview/</link><pubDate>Tue, 12 Nov 2019 16:30:21 +0000</pubDate><guid>https://www.poeticoding.com/the-primitives-of-phoenix-liveview/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/gPSXxtgmyB8" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>&lt;strong>Understanding Phoenix LiveView&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://www.poeticoding.com/how-to-setup-phoenix-liveview/">Setup&lt;/a>&lt;/li>
&lt;li>The Primitives (this article)&lt;/li>
&lt;li>&lt;a href="https://www.poeticoding.com/understanding-liveview-build-a-gallery-app/">Building a Gallery app&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>In the previous article we saw &lt;a href="https://www.poeticoding.com/how-to-setup-phoenix-liveview/">how to setup Phoenix LiveView&lt;/a>, in order to have everything we need to build a simple LiveView &lt;em>gallery app&lt;/em>.&lt;/p></description></item><item><title>How to Setup Phoenix LiveView</title><link>https://www.poeticoding.com/how-to-setup-phoenix-liveview/</link><pubDate>Tue, 29 Oct 2019 17:18:48 +0000</pubDate><guid>https://www.poeticoding.com/how-to-setup-phoenix-liveview/</guid><description>&lt;p>&lt;em>Updated for LiveView &lt;strong>0.11.0 - 7th April 2020&lt;/strong>&lt;/em>&lt;/p>
&lt;p>&lt;strong>Understanding Phoenix LiveView&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Setup &lt;em>(this)&lt;/em>&lt;/li>
&lt;li>&lt;a href="https://www.poeticoding.com/the-primitives-of-phoenix-liveview/">The Primitives&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.poeticoding.com/understanding-liveview-build-a-gallery-app/">Build a Gallery app&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>&lt;a href="https://github.com/phoenixframework/phoenix_live_view" target="_blank" rel="noopener">Phoenix LiveView&lt;/a> has been released on &lt;a href="https://hex.pm/packages/phoenix_live_view" target="_blank" rel="noopener">Hex&lt;/a>! Although it&amp;rsquo;s still not a stable release (at the time of writing &lt;strong>0.11.0&lt;/strong>), it works really well and it&amp;rsquo;s packed of cool features.&lt;/p></description></item><item><title>Using Select2 with Phoenix LiveView</title><link>https://www.poeticoding.com/using-select2-with-phoenix-liveview/</link><pubDate>Thu, 11 Jul 2019 15:19:10 +0000</pubDate><guid>https://www.poeticoding.com/using-select2-with-phoenix-liveview/</guid><description>&lt;p>&lt;strong>IMPORTANT&lt;/strong>: It&amp;rsquo;s now possible to do LiveView JS interop with hooks, which make everything much simpler and smoother! I&amp;rsquo;ve published an updated version of the article: &lt;a href="https://www.poeticoding.com/phoenix-liveview-javascript-hooks-and-select2/">Phoenix LiveView JavaScript Hooks and Select2&lt;/a>.&lt;/p>
&lt;p>LiveView doesn&amp;rsquo;t support JavaScript interop at the moment (but it&amp;rsquo;s a planned feature). So, let&amp;rsquo;s see how we can come up with a workaround to make LiveView playing together with a JavaScript library like &lt;a href="https://select2.org" target="_blank" rel="noopener">Select2&lt;/a>.&lt;/p></description></item><item><title>Phoenix LiveView live_link</title><link>https://www.poeticoding.com/phoenix-liveview-live_link/</link><pubDate>Wed, 26 Jun 2019 14:45:03 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-live_link/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/MIKMZpPPuMI" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>In &lt;a href="https://www.poeticoding.com/phoenix-liveview-change-the-url-without-refreshing-the-page/">the previous article focused on &lt;code>live_redirect&lt;/code>&lt;/a>, we&amp;rsquo;ve seen how in Phoenix LiveView we can change the URL without changing the location or refreshing the page. In this way we can keep the URL updated with the current page state, making easier for the user to bookmark or share it.&lt;/p></description></item><item><title>Phoenix LiveView - Change the URL without refreshing the page</title><link>https://www.poeticoding.com/phoenix-liveview-change-the-url-without-refreshing-the-page/</link><pubDate>Wed, 19 Jun 2019 16:11:17 +0000</pubDate><guid>https://www.poeticoding.com/phoenix-liveview-change-the-url-without-refreshing-the-page/</guid><description>&lt;div class="video">&lt;iframe src="https://www.youtube-nocookie.com/embed/Dad1mKexvu8" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="strict-origin-when-cross-origin">&lt;/iframe>&lt;/div>

&lt;p>It&amp;rsquo;s now possible to try the &lt;em>pushState&lt;/em> support available in Phoenix LiveView (which, remember, is still in beta)&lt;/p>
&lt;figure>&lt;img src="https://www.poeticoding.com/phoenix-liveview-change-the-url-without-refreshing-the-page/liveview_pushstate_github_commit.png" alt="Add live_link and live_redirect for push state support" loading="lazy" width="700" height="200">&lt;figcaption>Add live_link and live_redirect for push state support&lt;/figcaption>&lt;/figure>&lt;h4 id="what-is-pushstate-and-why-can-be-useful">What is &lt;em>pushState&lt;/em> and why can be useful?&lt;/h4>
&lt;p>With Phoenix LiveView we can easily update parts of the page without having to change the location, refreshing the page or directly use JavaScript.&lt;/p></description></item></channel></rss>