Commit Graph

206 Commits

Author SHA1 Message Date
968efb5492 fix: update UI of the show page
- Refactor to remove the link's padding-top.
- The navigation back button should now work as expected.
- No known side effects.
2025-02-15 11:50:36 +08:00
b6635e5a51 fix: fix map marker click and handle null values
-   Comment out marker click listener to fix a bug
-   Update _map.html.erb to handle null values in the city
-   Improve error handling

This commit addresses a bug where clicking the map marker
caused unexpected behavior.  The changes involve commenting out
the click listener to fix the issue, and updating the view
template to handle potential null values in the city object to
prevent unexpected behavior.
2025-02-15 11:48:40 +08:00
daa0ceac3e refactor: replace OpenLayers with Mapbox GL
- Replace OpenLayers with Mapbox GL for map rendering.
- Update CSS for map styling and control visibility.
- Integrate weather art into map popups.
- Add Mapbox token to credentials.yml.enc

This commit replaces the existing OpenLayers map implementation
with Mapbox GL. It also adjusts the styling and adds a
weather art display to the map popup, which enhances the
user experience. The necessary changes include modifying
stylesheets, JavaScript controllers, view templates, and
updating the credentials file. The motivation is to enhance
map rendering performance and user experience.
2025-02-15 11:21:12 +08:00
9ac7dd46af feat: migrate to OpenLayers for map display
Some checks are pending
Docker / docker (push) Waiting to run
- Replaced Leaflet with OpenLayers for improved map rendering
- Added OpenLayers CSS and removed Leaflet CSS
- Updated map controller to use OpenLayers API
- Added marker icon in public directory
- Added scopes and associations for weather art in City model

This change migrates the map display from Leaflet to
OpenLayers, providing better performance and more features.
It also introduces new model associations for weather arts,
allowing to sort cities by latest weather updates.
2025-02-15 00:19:04 +08:00
df456d1031 feat: add map feature to city show page
- Implement MapController for displaying city maps
- Add map rendering in the city show view
- Include weather arts in the city show controller
- Update asset pipeline to include Leaflet CSS and JS

This commit introduces a map feature that allows users to view
geographical information related to cities. The map is integrated
with weather arts data, enhancing the overall functionality of
the city show page.
2025-02-14 18:05:03 +08:00
95f94cb73b feat: add statistics card component and refactor views
- Introduce a new partial for displaying weather statistics in
  a consistent card format.
- Refactor the city show page to utilize the new statistics
  card partial, simplifying the code structure.
- Update layout and styling for improved UX and maintainability.

These changes enhance the maintainability of the codebase by
promoting reuse of the statistics card component and improving
the overall presentation of weather data for cities.
2025-02-14 14:56:51 +08:00
f43a6b4698 feat: add formatted time method for weather_art
- Introduce a new method `formatted_time` in the `WeatherArt` model
- Update various views to use this new method for date and time display
- Support formatting in local time zones or UTC

This update enhances the time representation for weather data, ensuring
that displayed times can reflect the user's local timezone or remain
fixed at UTC. This improves the usability of the application for
users in different regions.
2025-02-14 13:42:42 +08:00
681ad5320f style: update time display format
- Replace local timezone display with UTC in the weather
  display components
- Adjust time formatting in both city and weather art views

This change standardizes the time format across the application,
  making it clear that the displayed times are in UTC, aiding user
  understanding and consistency in time representation.
2025-02-14 11:58:16 +08:00
b01cbe960a fix: round load time to the nearest whole number
- Update load time display to show the rounded value instead of the
  raw measurement.
- This change improves the readability of the load time for end users
  by providing a more user-friendly format.

The adjustment enhances the user experience by presenting the load time
in a cleaner and more comprehensible manner.
2025-02-14 11:09:33 +08:00
1c13b89854 style: improve footer layout and text labels
- Simplified page views and visitors display in footer
- Improved readability by using labels and abbreviations
- Updated Tailwind CSS configuration for better font fallback

These changes enhance the user interface in the footer by making the
presentation of page views and visitors more concise and visually
appealing. The update also ensures a better font fallback
experience across different platforms.
2025-02-14 10:27:26 +08:00
95afdf1096 refactor: optimize includes for weather arts
- Changed includes for WeatherArt to optimize query
- Removed redundant includes of country in WeatherArt
- Simplified region fetching by directly ordering

These modifications improve the efficiency of the queries
by reducing unnecessary joins and utilizing ActiveRecord’s
query capabilities more effectively. The code change does not
affect the overall functionality but improves maintainability.
2025-02-14 10:01:24 +08:00
18977a9d42 feat: improve retrieval of weather arts
- Include associated city and image attachment in popular,
  random, latest, and featured arts queries to enhance data
  accessibility and performance.
- This modification reduces N+1 query issues by eager-loading
  associations, leading to improved query performance when
  accessing related data.
2025-02-14 09:55:04 +08:00
496dcf83a9 feat: add page load time tracking and footer
- Introduced PageLoadTimeController to measure and display
  page load times.
- Moved the footer content into a partial for better code
  organization.
- Added 'bullet' gem for performance monitoring.

This commit enhances the application by providing useful
information about load time directly in the UI and
refactoring the layout code for maintainability.
2025-02-14 09:47:01 +08:00
c808b72c63 refactor: use preview image for featured arts
Some checks are pending
Docker / docker (push) Waiting to run
- Use `preview_image(:large).processed` instead of `image`
  for displaying featured arts.

This change improves the performance of the homepage by
displaying a processed preview image instead of the original,
potentially large, image. This reduces the initial load time
and improves user experience.
2025-02-13 21:50:57 +08:00
50183539f5 fix: use processed preview image for art display
- Update image tag to display the processed preview image
- Ensures better performance and visual consistency

This change improves the rendering of art images by using
processed versions, which may reduce load time and improve
appearance on the front end.
2025-02-13 21:36:18 +08:00
ec96914067 refactor: improve string representation for countries
- Update links in cities index to include country emoji
- Modify display in cities show view to use emoji and country name
- Clean up random scope method in weather_art model for consistency

These changes enhance the user interface presentation by making
country names visually enriched with emojis, improving the overall
user experience with clearer visual cues.
2025-02-13 17:58:41 +08:00
eb16f5886d feat: enhance weather art display and functionality
- Update to include a new 'random' scope in WeatherArt model.
- Modify HomeController to fetch random and popular arts along with latest arts.
- Refactor index.html.erb to utilize a partial for rendering arts.

This update improves the display of weather art by adding a new
random selection of arts alongside popular ones, increasing user
engagement and variety. The code structure is also cleaner due
to the use of a partial view for rendering arts, promoting
the DRY principle.
2025-02-13 17:48:39 +08:00
be88aebac2 fix: update AI service logging and weather services 2025-02-13 17:21:41 +08:00
caf22a00ca style: update logging format in weather arts worker
- Change the order of displayed city attributes in logs
- Adjust tabulation for clearer output

This commit modifies the logging format used in the
BatchGenerateWeatherArtsWorker class. The attribute order for
city information in the log output has been changed to ensure
a more intuitive display, with regions now appearing before
countries and states. This will enhance readability during
logging without altering any functionality.
2025-02-13 16:54:15 +08:00
15c1fc654d feat: refine city selection process for weather art
- Implement daily generation limit for weather arts
- Improve city selection by prioritizing active cities
- Introduce logging for city generation start time and list

This update enhances the efficiency of the `BatchGenerateWeatherArtsWorker`. It ensures that the system respects a daily limit on the number of generated images and improves how cities are selected for processing by prioritizing active cities while also conditionally selecting others if slots remain. Additionally, the added logging provides better insights into the generation process.
2025-02-13 16:18:40 +08:00
5ae0367525 feat: enhance image handling for weather arts
- Remove deprecated `image_with_watermark` attachment.
- Introduce `webp_image`, `preview_image`, and `watermarked_image` methods in `WeatherArt` model for optimized image formats.
- Update views to use new image variants, including webp and previews, improving loading times and visual quality.
- Ensure images are processed with relevant attributes such as quality and dimensions for better performance and user experience.

These changes enhance the image handling capabilities of the application by ensuring images are served in a more efficient format (WebP) and with improved resizing options, leading to better performance overall.
2025-02-13 15:25:12 +08:00
5efe441fa8 style: improve sign out button layout
- Add padding and flex layout to the sign out button
- Wrap the icon and text in a div for better structure

These changes update the sign out button in the navbar for improved
accessibility and aesthetics, aligning it better with the overall UI
style.
2025-02-12 18:05:23 +08:00
7ebf20aa7b feat: enhance navbar responsiveness and styling
- Adjust main navigation layout for better spacing
- Improve mobile menu accessibility and usability
- Introduce a separate user menu partial for cleaner structure
- Update button styles and sizes for consistency

These changes aim to enhance the user experience by ensuring that the navbar is visually appealing and functional across different screen sizes, making navigation easier.
2025-02-12 18:03:40 +08:00
afcb9c6cd8 refactor: simplify scope limit parameters
- Change `limit:` to `limit =` in the scopes for
  `latest` and `by_popularity`.
- This allows for a default value of 100 to be used
  if no argument is provided, making the code more
  user-friendly and consistent.

This refactor does not alter the behavior of the
existing functionality but streamlines the syntax.
2025-02-12 18:00:30 +08:00
0a6926421f refactor: update popularity scope and controller logic
- Change `by_popularity` method in `City` model to use `start_time` for filtering views.
- Update `by_popularity` in `WeatherArt` model to limit results and incorporate the correct popularity calculation.
- Adjust `HomeController` to define `@popular_shuffle_arts` and `@latest_arts` with appropriate scopes.

These changes improve the accuracy of popularity retrieval for both cities and weather arts, simplifying the logic in the controller and leveraging updated model methods for performance.
2025-02-12 17:54:57 +08:00
940f1a8f76 feat: add country filter to cities controller
- Introduce filtering of cities by selected country
- Retrieve current country using friendly find method
- Apply city filtering if country is provided in parameters

This change allows users to efficiently filter cities based on the
selected country, providing a more tailored experience and
encouraging better navigation through the list of cities.
2025-02-12 15:12:23 +08:00
a1f1f2b728 fix: add turbo_frame data attribute to buttons
- Update buttons to include data attribute for Turbo frames
- Ensure proper behavior of navigation with turbo-enabled requests

This change enhances the functionality of the buttons by allowing them
 to interact with Turbo frames, improving performance and user
 experience when transitioning between different views on the application.
2025-02-12 14:59:19 +08:00
80c2f9a1df feat: add loading spinner and search updates
- Implement loading state in the search input with spinner.
- Optimize the search request to handle pending requests and cancels.
- Add dynamic response handling for Turbo frames to load search results.
- Create a new partial for city search results.
- Update the cities controller to support Turbo stream responses.

These enhancements improve user experience during searches by showing a loading
spinner and addressing potential issues with overlapping requests, ensuring
that the application remains responsive and functional when fetching city
search results.
2025-02-12 14:47:30 +08:00
799f3222a9 feat: add city search functionality
- Implement search_by_name scope in City model
- Add SearchController for handling search input
- Include _search_city partial in cities index view
- Update cities_controller to filter cities based on search query

This commit introduces a new feature that allows users to search for
cities by name using an input field. The search is implemented as a
scope in the City model, and it is integrated into the existing
CitiesController. A dedicated SearchController manages the input
submission with a debouncing mechanism for better performance. The
search field is rendered in the cities index view, enhancing user
interactivity and experience.
2025-02-12 14:00:03 +08:00
51d626a67f feat: add city popularity displays by time period
- Implement new scope in City model to fetch popular cities
- Query modified to consider different time periods: today, week, month, and year
- Update Ahoy Dashboard to show top cities for each time period

This change enhances the dashboard, providing insights into city popularity over varying durations, facilitating better data analysis.
2025-02-12 13:28:47 +08:00
34342a9678 refactor: make country and state associations optional
- Change 'belongs_to :country' association to be optional
- Change 'belongs_to :state' association to be optional

This refactoring allows a City record to exist without having
an associated Country or State, thus increasing the flexibility
of the data model for various use cases.
2025-02-12 13:08:12 +08:00
af4ee3ee21 feat: enhance image generation prompt clarity
- Add requirements for clearer and brighter images
- Specify maintenance of brightness even in overcast conditions
- Include enhancements for sunny day imagery
- Revise output prompt to remove unnecessary prefix and suffix

These changes improve the clarity and effectiveness of prompts
used in AI-generated imagery. The additional specifications help
guide the AI in producing visually appealing and contextually
relevant images for various weather conditions.
2025-02-12 11:56:09 +08:00
d045f532ec feat: enhance AI prompt generation logic
- Refactor prompt generation to separate location
  description functionality
- Update user prompt generation for DALL-E 3
- Improve AI service's response handling

This change enhances the AiService by creating a more
modular approach to generating prompts. The introduction
of a `generate_location_desc` method improves the
detail and context provided in the generated prompts.
Furthermore, the `ask_ai` method centralizes AI request
logic, allowing for cleaner and more organized code.
These adjustments should improve the overall robustness
and readability of the prompt generation process.
2025-02-12 11:33:11 +08:00
e39c87ac5c feat: improve prompt generation with location details
- Include state, country, and region in the DALL-E prompt
- Enhance context for the generated weather scene

This change improves the specificity of the prompts generated
for the AI, providing more contextual information such as
state, country, and region alongside the city name. This
enhancement can lead to more accurate and relevant outputs
from the DALL-E 3 model for weather scenes.
2025-02-12 10:02:47 +08:00
6f21fe001e fix: remove trailing whitespace in admin files
- Clean up trailing whitespace in app/admin/state.rb
- Clean up trailing whitespace in app/admin/subregions.rb
- Clean up trailing whitespace in app/admin/users.rb
- Adjust formatting in cities_controller.rb for consistency

These changes improve code readability and maintainability by
removing unnecessary whitespace. It is a small clean-up that prepares
files for better version control parsing and reduces the diff clutter.
2025-02-12 10:02:47 +08:00
92a5e4d3b0 fix: update generation interval for weather arts worker
- Change generation interval from 24 hours to 36 hours

This change provides more flexibility in scheduling weather arts generation, which could lead to better resource management or accommodate changes in data availability.
2025-02-11 23:32:47 +08:00
b2551361d7 feat: add admin management features for cities
- Update menu labels for cities, countries, and regions
- Introduce new entities for states and subregions in Admin Panel
- Implement admin authentication for weather art generation
- Modify application controller to check for admin user
- Refactor view to display admin panel based on user permissions
- Update routes to include weather art generation action

These changes enhance the admin interface for better management of cities
and related entities. The new admin checks ensure that only authorized users
can generate weather art, improving security and functionality.
2025-02-11 17:40:13 +08:00
973a0882ed feat: add admin panel and update database URL
- Implemented a new admin panel that allows administrators to view
  statistics and manage weather art. The panel includes:
  - A card displaying total images and today's images
  - Buttons to generate new art and edit the city

- Added `admin?` helper method to check if the current user is an
  administrator.

- Updated database configuration to use safer credentials lookup
  method `dig` for development database URL instead of the
  previous method, improving reliability in accessing nested
  credentials.
2025-02-11 16:56:51 +08:00
be1f76a76d feat: enhance devise views with new styling
- Updated confirmation, password, unlock, and session views to use a
  card-based layout for improved visual appeal.
- Added responsive design features to ensure compatibility across devices.
- Enhanced usability by providing clear placeholders in form fields.

These changes improve the user experience during account recovery and
management processes. The design promotes a modern interface while
maintaining functionality.
2025-02-11 16:43:05 +08:00
7d25bc8f11 feat: enhance user authentication features
- Add confirmable and lockable modules to user model
- Update error messages display with improved UI
- Modify navbar links for better accessibility and styling
- Add unique indexes for confirmation and unlock tokens in migration

These changes improve user management and user experience by
adding features for account activation and security, along
with styling enhancements for the authentication views.
2025-02-11 16:18:10 +08:00
0312383bc8 feat: add flash message functionality
- Implement Stimulus controller for closing flash messages
- Replace inline alerts with a partial for better organization
- Enhance styling for user registration and login forms

This update introduces a new flash message component that allows
for user notifications to be displayed on the screen and closed by
the user. The forms also include improved styles for a better
user experience.
2025-02-11 15:52:58 +08:00
cba76e718f feat: enhance user registration UI and navigation
- Improve the user registration form layout with card styling.
- Add input classes for better design consistency.
- Introduce a new navbar partial for better component management.
- Removed the old navbar code to streamline application layout.

These changes provide a more modern and user-friendly experience during
user registration and improve the overall site's navigation structure.
2025-02-11 15:28:42 +08:00
1545b33539 feat: add user authentication with devise
- Integrate Devise for user authentication
- Create User model and necessary views
- Implement email confirmation and password reset functionality
- Add routing for user sign-up and login
- Customize error messages display

This commit initiates user authentication in the application
using the Devise gem. It includes user registration, login,
password reset, and email confirmation features. Additionally,
the necessary views and mailer templates are included to
support these functionalities. This enhances the security
and usability of the application by allowing users to create
accounts and manage their passwords effectively.
2025-02-11 14:45:23 +08:00
652107d0ee migrate with countries_states_cities_db 2025-02-08 17:42:50 +08:00
6281ca73a2 fix: update created_at timestamp display
- Change displayed time from weather_date to created_at in
  cities and weather arts show templates. This ensures that the
  time shown reflects when the record was created instead of the
  weather date which may not be accurate for representation.
2025-02-08 09:25:08 +08:00
1286eff996 fix: update view count display in Ahoy Dashboard
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Docker / docker (push) Waiting to run
- Change column header from '访问(日/周/年)' to '访问(DWMY)' to reflect
  updated metrics.
- Adjust metrics to include monthly view count alongside daily,
  weekly, and yearly counts.

This modification improves clarity by explicitly indicating the
metrics being displayed in the dashboard, thereby aiding users in
understanding the data better.
2025-02-07 17:42:17 +08:00
9ee8ed0d10 feat: enhance view count method for city
- Update view_count method to accept different time periods
- Modify ahoy_dashboard to display views per day, week, and year

These changes provide a more granular view of city visits, allowing for
better analytics and insights on user engagement over time.
2025-02-07 17:32:49 +08:00
9865c18d32 feat: add additional columns to city dashboards
Some checks are pending
Docker / docker (push) Waiting to run
- Add '图像个数' column to show the count of weather arts.
- Add '最后更新时间' column to display the last weather fetch time.

These additions enhance the information displayed in the Ahoy Dashboard and
Cities admin panel, providing more context for each city.
2025-02-07 16:41:23 +08:00
e6550aa86f feat: add active and inactive city counts to dashboard
- Add display of activated and non-activated city counts
- Introduce a new scope for inactive cities in City model
- Update Ahoy Dashboard to show the total count of both active and inactive cities

This update provides better insights into city activation status within the
Ahoy Dashboard. It introduces a new function in the City model and updates
the dashboard to reflect these statistics, assisting in better monitoring
of city status.
2025-02-07 13:11:42 +08:00
d418232e7b refactor: update admin columns for Ahoy models
Some checks failed
Docker / docker (push) Has been cancelled
- Removed user_id, city, country, and region columns
- Added visit_id, visit_token, referrer, landing_page,
  browser, os, and device_type columns

This refactor improves the administrative interface for Ahoy
models by updating the displayed attributes to better suit
the current application requirements. It also aligns the
displayed data with the available attributes in the Ahoy
tracking system, making it easier for administrators to
review relevant information.
2025-02-05 16:57:37 +08:00
4dca074c6d feat: enhance Ahoy dashboard city listings
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Docker / docker (push) Has been cancelled
- Add ID column to least popular active cities table
- Improve region display in cities table
- Remove commented-out code section for cleaner view

This update enhances the Ahoy dashboard by providing more
information in the cities listing, specifically the ID
of each city and a clearer representation of the region
it belongs to. Additionally, it removes outdated code to
improve maintainability.
2025-02-05 15:12:29 +08:00
b97ac8b91d fix: correct handling of watermark attachment check
- Change return condition in add_watermark method from
  'return' to 'nil'.
- Ensure that the method correctly acknowledges the
  presence of an existing watermark image, allowing for
  further processing if necessary.

This change improves the clarity and functionality of the
add_watermark method by explicitly indicating when no
further action should be taken.
2025-02-05 14:57:28 +08:00
ba8957e444 refactor: simplify city table queries
- Removed the limit on City queries in the Ahoy Dashboard
- Updated table_for calls for least popular active and most popular inactive cities to fetch all records instead of limiting to 10

This change allows the dashboard to display all relevant cities without
artificial limits, providing a more comprehensive overview of city
activity. The previous limitations may have hidden important data for
analysis and reporting purposes.
2025-02-05 14:57:08 +08:00
cd26313808 chore: update dependencies in Dockerfile and Gemfile
- Remove unused `ruby-vips` gem from Gemfile
- Update Dockerfile to remove `libvips42` package, which is no longer needed
- Comment out legacy watermarking code in `AddWatermarkToWeatherArtWorker`

These changes streamline the dependencies, making the
project lighter and reduce potential security issues with
unused gems and packages. The watermarking functionality is now
commented out for potential future use but is not currently
needed.
2025-02-05 14:53:54 +08:00
a60f1bfe38 feat: enhance city status management in dashboard
- Change table to display cities based on popularity
- Modify button logic to toggle between "停用" (disable) and "激活" (activate) based on current city status

This update improves the usability of the Ahoy Dashboard by providing
clearer management options for city statuses. Users can now easily
activate or deactivate cities from the dashboard, enhancing overall
administrative efficiency.
2025-02-05 14:39:43 +08:00
76a8275af6 feat: add city ranking panel to dashboard
- Implement a new panel in the Ahoy Dashboard
- Display least popular active cities along with their visit counts
- Include action buttons to toggle city statuses with confirmations

This addition enhances the admin dashboard by providing insights into
city rankings based on user visits. It allows administrators to
manage city statuses directly from the dashboard, improving usability
and functionality.
2025-02-05 14:18:59 +08:00
31c2913ea6 refactor: adjust ordering of weather arts
Some checks failed
Docker / docker (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
- Change ordering of previous weather art to use 'id' descending
- Change ordering of next weather art to use 'id' ascending
- Remove unnecessary blank line in seeds file

These changes enhance the consistency of the weather art
navigation by using 'id' for ordering, ensuring the
correct retrieval of records.
2025-02-03 11:15:31 +08:00
884e1dfc9f feat: add navigation between weather arts
- Implement previous and next weather art navigation
- Update weather arts controller to fetch adjacent weather arts
- Modify show view to include navigation links

This update enhances the user experience by allowing users to
navigate through weather arts seamlessly. The previous and
next buttons improve accessibility, providing a smoother
browsing experience. The implementation also accounts for
situations where no adjacent weather arts exist, ensuring
clarity for users.
2025-02-03 11:09:31 +08:00
5d1846e0a0 refactor: update weather art display
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Docker / docker (push) Waiting to run
- Remove unnecessary image tag
- Add city name to weather art title
- Improve image scaling effect

These changes aim to enhance the user experience by providing a clearer and more visually appealing representation of the weather art, including the location it represents.
2025-02-02 14:23:06 +08:00
130a8983a1
Update application.html.erb 2025-02-02 10:46:06 +08:00
536b97a7da feat: update latest weather art display
- Change latest weather art limit from 6 to 20
- Shuffle the collection and display the last 10 items
- Update the section title to reflect the shuffling

This commit enhances the visibility of the latest weather art by
increasing the limit of displayed items. It randomizes the selection
of the latest art pieces for a more dynamic user experience, while the
UI title is updated to clarify this feature. This change improves user
engagement with the content.
2025-02-02 00:21:51 +08:00
f2951e2741 feat: optimize batch weather art generation
- Introduce BATCH_SIZE constant to limit processed cities
- Shuffle and limit eligible cities processing to enhance worker efficiency

This update improves the performance of the BatchGenerateWeatherArtsWorker
by ensuring that only a set number of cities are processed within the
allotted time, reducing the risk of timeouts and making the overall
system more responsive.
2025-02-01 15:01:36 +08:00
9417358625 refactor: adjust image loading in weather art view
- Update image link to use original blob instead of a resized variant
- Remove the resizing option for the image tag for better fidelity
- Modify CSS class for a smoother hover effect without scaling issues

This refactor improves the image loading behavior by allowing
full-resolution images to be loaded directly. The previous resizing
was limiting image quality, and this change enhances user experience
when viewing weather art.
2025-02-01 14:58:51 +08:00
09b3f06ad4 style: adjust pagination button sizes
- Change button classes from `btn` to `btn btn-xs` for all pagination buttons
- Ensure consistent styling across all pagination elements

These changes standardize the button sizes in the pagination component, improving the visual uniformity. The adjustment enhances user experience by making the pagination buttons more appropriately sized within the interface, without affecting functionality.
2025-02-01 14:45:17 +08:00
05449d1e7f chore: update PhotoSwipe import paths
- Change import for PhotoSwipeLightbox to 'photoswipe/lightbox'
- Change import for PhotoSwipe to 'photoswipe'

These updates reflect the new module structure of the PhotoSwipe library, ensuring that the controller utilizes the correct paths for improved functionality and maintainability.
2025-02-01 14:31:53 +08:00
905ec35fd8 feat: add photo swipe lightbox functionality
- Integrate PhotoSwipe library for enhanced image viewing
- Create PhotoSwipeLightBoxController to manage images
- Register lightbox controller in Stimulus framework
- Update views to include lightbox functionality
- Modify styles to accommodate new design elements

This commit introduces a new way for users to view images with
PhotoSwipe, improving the interactivity of the photo gallery. It
also includes adjustments to the layout and styles for better
presentation and user experience.
2025-02-01 14:19:19 +08:00
0352923c5b feat: update weather data report format
Some checks are pending
Docker / docker (push) Waiting to run
- Include actual update time in weather report
- Rename watermark worker file for clarity

This commit enhances the weather data report by
updating the format to include the actual update time
retrieved from the weather service API. Additionally,
the watermark worker file has been renamed to improve
readability and consistency in the naming convention.
2025-01-31 10:46:32 +08:00
bbf8dfc2e6 feat: add watermarking functionality to weather art
Some checks failed
Docker / docker (push) Has been cancelled
- Include the image_processing gem to handle image manipulation
- Create a background worker for adding watermarks to weather art images
- Update WeatherArt model to attach watermark images
- Add a new watermark image asset

This commit enhances the WeatherArt feature by allowing images to
have watermarks added asynchronously, improving the visual
presentation of the art. It ensures sufficient image dimensions
before processing and includes error handling for the worker.
2025-01-29 01:53:50 +08:00
62bfe8888e feat: add toggle city status action
Some checks are pending
Docker / docker (push) Waiting to run
- Implement city status toggle functionality in the Ahoy Dashboard
- Add buttons for activating and deactivating cities
- Update the UI to show the current status of cities

This commit enhances the admin dashboard by allowing
administrators to toggle the activation status of cities.
The buttons provide confirmation prompts before executing
state changes, improving user experience and preventing
accidental actions.
2025-01-28 02:12:09 +08:00
138d610c3a chore: remove unused job classes
- Delete BatchGenerateWeatherArtsJob which queued jobs for generating
  weather art for eligible cities.
- Remove CleanAhoyDataJob responsible for cleaning up old Ahoy events
  and visits.
- Eliminate GenerateWeatherArtJob that managed the generation
  and attachment of weather art images.
- Drop RefreshSitemapJob which created and uploaded XML sitemaps.

These removals suggest a shift in how these functionalities will be
handled, possibly indicating a move towards a different architecture
or integration with another service.
2025-01-28 01:50:49 +08:00
c332230709 feat: enhance city localization and timezone handling
- Update localized_name method to provide a default value for
  missing translations
- Modify timezone display in city show view to show a message
  when the timezone is undefined

These changes improve user experience by ensuring that the city
localization falls back to the city name itself if a translation
is not found, and they handle potentially missing timezone data
more gracefully.
2025-01-28 01:49:13 +08:00
f0f94de528 feat: refactor code organization and query complexity
- Simplify query for most popular inactive cities in City model
    - Minor layout changes in Admin Dashboards for Ahoy and Sidekiq tasks

    This refactoring improves code organization, reducing complexity in the City model and making it easier to read. Additionally, the Admin dashboard layouts have been simplified for a better user experience.
2025-01-28 01:44:07 +08:00
069b6d4a4f feat: add ahoy dashboard and city statistics
- Introduce a new admin dashboard for viewing Ahoy statistics.
- Display total visits, event counts, and unique visitors.
- List most popular and least popular active cities with their visit counts.
- Add a panel for recent events.
- Modify existing dashboard to include a section for inactive cities.

This commit introduces a comprehensive dashboard that helps
admin users monitor the traffic and engagement statistics of
various cities. The changes include functionality to show
active and inactive cities based on their popularity,
allowing for better insights into user engagement across
the application.
2025-01-28 01:43:59 +08:00
2a0226eb68 feat: update sidekiq tasks manager for clarity
- Rename task label from 'Batch Generate Weather Arts' to 'Generate Weather Arts' for better understanding.
- Add a new button for manual task execution of 'BatchGenerateWeatherArts'.
- Update task value in form submissions to be more descriptive, enhancing maintainability.

These changes improve the usability of the Sidekiq tasks management interface, making it more intuitive for users to identify and execute tasks. The renamed button and the clear distinction between tasks aim to reduce confusion and assist in better workflow management.
2025-01-28 01:32:56 +08:00
8cd4c50024 fix: update log level for user agent logging
- Change logging to use Rails.logger.debug instead of
  Rails.logger.debugger for better compatibility.
- Remove unnecessary extra lines in the Sidekiq jobs file.

This commit ensures that log messages are recorded efficiently and
with the correct log level, improving logging practices in the
application.
2025-01-28 01:28:07 +08:00
4020f89271 style: change logging level for user agent
- Replace logger.info with logger.debugger for user agent logging.
- Commented out redundant info logging for blocked browsers.

This change improves the logging detail level for the user agent by
utilizing the debugger log method instead of info, which provides more
context during debugging sessions.
2025-01-28 01:26:31 +08:00
29de36f5fb chore: comment out deprecated allow_browser code
- Commented out the `allow_browser` lines to prevent
  disabling access for unsupported browsers.
- This change maintains previous behavior without removing
  the code permanently, allowing for future reference.
- The previous implementation was causing issues with
  newer browser versions, prompting the need for a review
  of browser support policies.
2025-01-28 01:25:40 +08:00
2e438166ee feat: implement sidekiq task management
- Add manual task execution buttons for BatchGenerateWeatherArtsWorker, RefreshSitemapWorker, and CleanAhoyDataWorker
- Improve browser blocking functionality in ApplicationController
- Refactor Sidekiq jobs management to include statistics and task execution
- Update various jobs to conform to new standards

This feature allows for more fine-grained control over Sidekiq tasks and improves the overall user experience.
2025-01-28 01:24:49 +08:00
bf2ff282bb refactor: rename workers to jobs
- Change class names from Worker to Job for better alignment
  with Rails convention.
- Includes changes in BatchGenerateWeatherArtsJob,
  CleanAhoyDataJob, GenerateWeatherArtJob, and
  RefreshSitemapJob classes.

This refactoring improves the clarity and consistency of the
codebase by adhering to established naming conventions,
making it easier for new developers to understand the
role of these classes within the application.
2025-01-28 01:16:17 +08:00
ce5d09b621 feat: add admin management for various entities
- Add menu labels and parents for AdminUser, City, Country, Region, WeatherArt, Ahoy::Event, and Ahoy::Visit.
- Introduce a new page for managing Sidekiq jobs, providing functionality to execute or delete scheduled jobs.
- Adjust batch job for generating weather art by using Sidekiq for improved performance.
- Implement clean-up worker for old Ahoy data and functionalities for refreshing the sitemap.

These changes enhance the administration interface by providing better organization and management tools for backend entities. The addition of Sidekiq jobs management further improves system maintenance capabilities.
2025-01-28 01:15:29 +08:00
c68fecf3fa
Update application_controller.rb 2025-01-27 09:50:39 +08:00
16ee512b0c
Update application_controller.rb 2025-01-27 09:42:08 +08:00
111fd85ebb
Update application_controller.rb 2025-01-27 09:30:01 +08:00
59a3f792c6
Update application_controller.rb 2025-01-27 09:20:14 +08:00
9e666310cf
Update application_controller.rb 2025-01-27 09:14:19 +08:00
cc74145033
Update application_controller.rb 2025-01-27 09:00:54 +08:00
3e713a9b26
Update application_controller.rb 2025-01-27 08:43:50 +08:00
263c85486c
Update application_controller.rb 2025-01-27 08:23:44 +08:00
a895216bda
Update application_controller.rb
Some checks are pending
Docker / docker (push) Waiting to run
2025-01-27 07:49:08 +08:00
75cdd69b9b
Update application_controller.rb 2025-01-27 07:40:13 +08:00
70f977cae1 更新 application.html.erb 2025-01-27 07:01:20 +08:00
444c3e67bc 更新 application.html.erb 2025-01-27 07:01:20 +08:00
ffbd201d62 更新 application_controller.rb 2025-01-27 07:01:20 +08:00
5bfa94bc82
更新 application.html.erb 2025-01-27 06:54:24 +08:00
f59955ca6e
更新 application.html.erb 2025-01-27 01:38:21 +08:00
6eca78da8d fix: update JSONB handling for ahoy events
- Change query conditions in City model to use the
  `properties::jsonb` syntax for compatibility.
- Update WeatherArt model's event counting to reflect
  the same JSONB handling for consistency across models.

These changes ensure that the queries correctly access the
JSONB fields in the database, which enhances robustness
when handling different database adapters like Postgres
or SQLite. This fixes potential issues with ahoy events
not being counted accurately due to incorrect property access.
2025-01-27 01:05:16 +08:00
f918a42619 fix: correct string quotation in city scope
- Change single quotes to double quotes for adapter name check

This change ensures consistent usage of double quotes in the
conditional check for the SQLite adapter. It does not affect
any functionality but improves code readability.
2025-01-27 00:50:35 +08:00
adb671e668 feat: add least popular active cities panel
- Introduce new panel in the admin dashboard for displaying
  the least popular active cities.
- Implement a database scope `least_popular_active` to
  retrieve cities based on their view counts.
- Ensure compatibility with both SQLite and PostgreSQL
  for fetching city view data.

This addition enhances the admin dashboard by allowing
administrators to easily identify and manage cities that
are receiving less user interaction, thus aiding in strategic
planning for engagement and promotion.
2025-01-27 00:48:07 +08:00
50321533f7 chore: clean up trailing whitespace and formatting
- Removed unnecessary leading and trailing blank lines in several
  ActiveAdmin register files.
- Reformatted string delimiters for consistency, changing single quotes
to double quotes in tracking events in the Cities and WeatherArts
controllers.
- Ensured proper spacing in array definitions across several
  models, including Ahoy::Event and Ahoy::Visit.

These changes improve code readability and maintain consistency
throughout the codebase by ensuring uniform use of quotes and
removing excess whitespace.
2025-01-27 00:43:36 +08:00
dd6cd0451d feat: add ahoy analytics for event tracking
- Integrate Ahoy gem for tracking user events and visits
- Create models for Ahoy events and visits
- Implement admin interfaces for managing events and visits
- Add background job for cleaning up old analytics data
- Update application controller and other relevant controllers to track specific actions

This commit implements a comprehensive event tracking system that logs user interactions
within the application. Additionally, it includes mechanisms for managing and
cleaning historical visit and event data, ensuring efficient data handling.
2025-01-27 00:43:18 +08:00