2025-01-24 10:01:43 +08:00
|
|
|
<div class="min-h-screen bg-base-200">
|
2025-01-20 18:02:28 +08:00
|
|
|
<!-- 城市头部信息 -->
|
2025-01-24 10:01:43 +08:00
|
|
|
<section class="relative h-[50vh] overflow-hidden">
|
2025-01-20 18:02:28 +08:00
|
|
|
<% if @city.latest_weather_art&.image&.attached? %>
|
|
|
|
<%= image_tag @city.latest_weather_art.image,
|
|
|
|
class: "w-full h-full object-cover" %>
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="absolute inset-0 bg-gradient-to-t from-base-100 via-base-100/60 to-transparent"></div>
|
2025-01-20 18:02:28 +08:00
|
|
|
<% end %>
|
2025-01-19 22:08:05 +08:00
|
|
|
|
2025-01-20 18:02:28 +08:00
|
|
|
<div class="absolute inset-0 flex items-center">
|
|
|
|
<div class="container mx-auto px-4">
|
|
|
|
<div class="max-w-4xl">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="flex items-center space-x-4 mb-6">
|
2025-01-20 18:02:28 +08:00
|
|
|
<%= link_to cities_path,
|
2025-01-24 10:01:43 +08:00
|
|
|
class: "btn btn-ghost btn-circle bg-base-100/50 backdrop-blur-sm hover:bg-base-100/70" do %>
|
2025-01-20 18:02:28 +08:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
|
|
|
|
</svg>
|
|
|
|
<% end %>
|
2025-01-24 10:01:43 +08:00
|
|
|
<div>
|
|
|
|
<h1 class="text-4xl md:text-5xl font-display font-bold mb-2"><%= @city.localized_name %></h1>
|
|
|
|
<p class="text-lg opacity-80">
|
|
|
|
<%= @city.country.name %>, <%= @city.region %>
|
|
|
|
<span class="mx-2">•</span>
|
|
|
|
<%= Time.current.in_time_zone(@city.timezone).strftime("%Y-%m-%d %H:%M") %>
|
|
|
|
</p>
|
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</div>
|
|
|
|
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="stats bg-base-100/80 backdrop-blur-sm shadow-lg rounded-box">
|
2025-01-20 18:02:28 +08:00
|
|
|
<div class="stat">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="stat-title">Latest Weather</div>
|
|
|
|
<div class="stat-value text-2xl">
|
|
|
|
<%= @city.latest_weather_art&.temperature %>°C
|
|
|
|
</div>
|
|
|
|
<div class="stat-desc">
|
|
|
|
<%= @city.latest_weather_art&.description %>
|
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</div>
|
|
|
|
<div class="stat">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="stat-title">Coordinates</div>
|
|
|
|
<div class="stat-value text-xl">
|
|
|
|
<%= @city.latitude %>°N, <%= @city.longitude %>°E
|
|
|
|
</div>
|
|
|
|
<div class="stat-desc">Geographical Location</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</div>
|
|
|
|
<div class="stat">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="stat-title">Weather Records</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
<div class="stat-value text-2xl"><%= @city.weather_arts.count %></div>
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="stat-desc">Total Entries</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-19 22:08:05 +08:00
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</section>
|
2025-01-19 22:08:05 +08:00
|
|
|
|
2025-01-20 18:02:28 +08:00
|
|
|
<!-- 天气艺术历史记录 -->
|
|
|
|
<section class="container mx-auto px-4 py-16">
|
|
|
|
<div class="space-y-8">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="flex justify-between items-center">
|
|
|
|
<h2 class="text-3xl font-display font-bold">Weather Art History</h2>
|
|
|
|
<div class="stats shadow inline-flex">
|
|
|
|
<div class="stat">
|
|
|
|
<div class="stat-title">Last Updated</div>
|
|
|
|
<div class="stat-value text-primary text-lg">
|
|
|
|
<%= time_ago_in_words(@city.last_weather_fetch) if @city.last_weather_fetch %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
2025-01-20 18:02:28 +08:00
|
|
|
<% @city.weather_arts.order(weather_date: :desc).each do |art| %>
|
|
|
|
<div class="card bg-base-100 shadow-xl hover:shadow-2xl transition-all duration-300">
|
2025-01-24 10:01:43 +08:00
|
|
|
<figure class="relative aspect-video overflow-hidden">
|
2025-01-20 18:02:28 +08:00
|
|
|
<% if art.image.attached? %>
|
|
|
|
<%= image_tag art.image,
|
|
|
|
class: "w-full h-full object-cover transform hover:scale-105 transition-transform duration-500" %>
|
|
|
|
<% end %>
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/70 to-transparent">
|
2025-01-20 18:02:28 +08:00
|
|
|
<div class="text-white">
|
2025-01-24 10:01:43 +08:00
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<div class="text-3xl font-bold"><%= art.temperature %>°C</div>
|
|
|
|
<div class="text-right">
|
|
|
|
<div class="text-sm font-semibold">
|
|
|
|
<%= art.weather_date.strftime("%H:%M") %>
|
|
|
|
</div>
|
|
|
|
<div class="text-xs opacity-80">
|
|
|
|
<%= art.weather_date.strftime("%B %d, %Y") %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
<div class="card-body">
|
|
|
|
<h3 class="card-title font-display"><%= art.description %></h3>
|
|
|
|
|
|
|
|
<div class="grid grid-cols-2 gap-4 my-4 text-sm">
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 opacity-70" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
2025-01-24 10:01:43 +08:00
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.5 14.7a3 3 0 11-6 0 3 3 0 016 0z" />
|
2025-01-20 18:02:28 +08:00
|
|
|
</svg>
|
|
|
|
<span>Humidity: <%= art.humidity %>%</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 opacity-70" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
|
|
|
|
</svg>
|
|
|
|
<span>Wind: <%= art.wind_scale %></span>
|
|
|
|
</div>
|
2025-01-19 22:08:05 +08:00
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
|
2025-01-24 10:01:43 +08:00
|
|
|
<%= link_to city_weather_art_path(@city, art),
|
|
|
|
class: "btn btn-primary btn-block" do %>
|
|
|
|
View Details
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
|
|
</svg>
|
|
|
|
<% end %>
|
2025-01-19 22:08:05 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2025-01-19 22:08:05 +08:00
|
|
|
</div>
|
2025-01-20 18:02:28 +08:00
|
|
|
</section>
|
2025-01-19 22:08:05 +08:00
|
|
|
</div>
|