diff --git a/app/javascript/application.js b/app/javascript/application.js index d933293..8a40626 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,3 +1,8 @@ // Entry point for the build script in your package.json import "@hotwired/turbo-rails" +import "@fontsource/playfair-display/400.css"; +import "@fontsource/playfair-display/700.css"; +import "@fontsource/raleway/400.css"; +import "@fontsource/raleway/600.css"; + import "./controllers" diff --git a/app/models/city.rb b/app/models/city.rb index 891a90d..e6d955a 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -20,4 +20,8 @@ class City < ApplicationRecord ["active", "country", "created_at", "id", "id_value", "last_image_generation", "last_weather_fetch", "latitude", "longitude", "name", "priority", "region", "slug", "timezone", "updated_at"] end + def latest_weather_art + weather_arts.order(weather_date: :desc).first + end + end diff --git a/app/views/cities/index.html.erb b/app/views/cities/index.html.erb index cbd8c97..357e0b8 100644 --- a/app/views/cities/index.html.erb +++ b/app/views/cities/index.html.erb @@ -1,15 +1,32 @@ -
-

Cities

+
+
+

Explore Cities

+

+ Discover AI-generated weather art from cities around the world +

+
-
+
<% @cities.each do |city| %> -
-
-

<%= city.name %>

-

Latitude: <%= city.latitude %>

-

Longitude: <%= city.longitude %>

-
- <%= link_to "View Weather Art", city_path(city), class: "btn btn-primary" %> + <% latest_art = city.weather_arts.last %> +
+ <% if latest_art&.image&.attached? %> +
+ <%= image_tag latest_art.image, + class: "w-full h-full object-cover transform group-hover:scale-105 transition-transform duration-500" %> +
+
+ <% end %> + +
+

<%= city.name %>

+
+

Lat: <%= city.latitude %>

+

Long: <%= city.longitude %>

+
+
+ <%= link_to "View Weather Art", city_path(city), + class: "btn btn-primary" %>
diff --git a/app/views/cities/show.html.erb b/app/views/cities/show.html.erb index c8407fd..f106856 100644 --- a/app/views/cities/show.html.erb +++ b/app/views/cities/show.html.erb @@ -1,49 +1,91 @@ -
-
-

<%= @city.name %>

- <%= link_to "Back to Cities", cities_path, class: "btn btn-ghost" %> -
+
+ +
+ <% if @city.latest_weather_art&.image&.attached? %> + <%= image_tag @city.latest_weather_art.image, + class: "w-full h-full object-cover" %> +
+ <% end %> -
-
-
Latitude
-
<%= @city.latitude %>
-
-
-
Longitude
-
<%= @city.longitude %>
-
-
- -
-

Weather Art History

-
- <% @city.weather_arts.order(weather_date: :desc).each do |art| %> -
-
- <% if art.image.attached? %> - <%= image_tag art.image, class: "w-full h-48 object-cover" %> +
+
+
+
+ <%= link_to cities_path, + class: "btn btn-ghost btn-circle" do %> + + + <% end %> -
-
-

<%= art.weather_date.strftime("%Y-%m-%d") %>

-

<%= art.description %>

-
-
-
Temperature
-
<%= art.temperature %>°C
-
-
-
Humidity
-
<%= art.humidity %>%
-
+

<%= @city.name %>

+
+ +
+
+
Latitude
+
<%= @city.latitude %>
-
- <%= link_to "View Details", city_weather_art_path(@city, art), class: "btn btn-primary" %> +
+
Longitude
+
<%= @city.longitude %>
+
+
+
Weather Arts
+
<%= @city.weather_arts.count %>
- <% end %> +
-
+
+ + +
+
+

Weather Art History

+ +
+ <% @city.weather_arts.order(weather_date: :desc).each do |art| %> +
+
+ <% if art.image.attached? %> + <%= image_tag art.image, + class: "w-full h-full object-cover transform hover:scale-105 transition-transform duration-500" %> + <% end %> +
+
+
<%= art.temperature %>°C
+
<%= art.weather_date.strftime("%B %d, %Y") %>
+
+
+
+ +
+

<%= art.description %>

+ +
+
+ + + + Humidity: <%= art.humidity %>% +
+
+ + + + Wind: <%= art.wind_scale %> +
+
+ +
+ <%= link_to "View Details", city_weather_art_path(@city, art), + class: "btn btn-primary btn-outline" %> +
+
+
+ <% end %> +
+
+
\ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 77503ce..7d97af9 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,46 +1,60 @@ -
- -
-

AI Weather Art

-

Discover the beauty of weather through AI-generated art

-
- - -