Commit Graph

63 Commits

Author SHA1 Message Date
9ef2a92d60 feat: add multiple language support for locales
- Extend available locales in the application to include:
  - Portuguese (Brazil)
  - Croatian
  - Persian
  - German
  - Spanish
  - French
  - Italian
  - Turkish
  - Russian
  - Ukrainian
  - Polish

- Create new locale files for each language with appropriate translations.
- Update existing locale files to include new languages.

This update enhances the application's accessibility by supporting a wider range of languages, allowing users from different regions to interact with the application in their native language.
2025-02-24 15:46:29 +08:00
03c957e654 feat: add date formats to localization
- Introduce default, short, and long date formats
- Enhance date representation for better user experience

This update allows the application to display dates in multiple formats,
including a default format of 'YYYY-MM-DD', a short format of
'"MMM DD"', and a long format of '"Month DD, YYYY"'. This
improves localization support and user interface flexibility.
2025-02-24 14:20:49 +08:00
09fa1ceea9 feat: update sitemap generation for multiple locales
- Refactor generate_sitemap method to support locale
- Add setup_sitemap_config method for configuration
- Implement sitemap generation for default and localized paths

This update enhances the sitemap generation process by supporting
multiple languages. Users can now access a sitemap with language
prefixes, improving SEO and usability for different locales.
Additionally, error handling has been improved to log specific
errors related to locale generation.
2025-02-22 12:08:59 +08:00
bd42833953 feat: add translatable name module for countries and regions
- Introduced `TranslatableName` module to allow for
  localized names for `Country` and `Region` models.
- Updated views to display `localized_name` instead of
  `name` for improved internationalization.
- Refactored JSON serialization for `translations` attribute.
- Enhanced localization support by adding new languages:
  Japanese and Korean, with updated locale files.
- Removed outdated English and Chinese locales for countries
  and regions to clean up the codebase.
2025-02-21 23:46:25 +08:00
f6b9dcf187 feat: add internationalization support
- Implement locale extraction and fallback mechanism
- Add translation files for English and Chinese
- Update views to use translated strings for various UI elements

This commit introduces support for multiple languages in the application, enhancing accessibility for users. It includes a fallback mechanism for locales and updates to the user interface to display translated content.
2025-02-21 17:51:25 +08:00
9fe92b1fc4 feat: add RSS feed functionality
Some checks failed
Docker / docker (push) Has been cancelled
- Introduce RssController to handle RSS feed requests
- Add a new route for the RSS feed
- Implement RSS feed view to display weather art
- Update application layout to include RSS feed link
- Set content type for RSS responses

This commit adds an RSS feed feature that allows users to
subscribe to updates on daily AI-generated weather art.
The feed includes the latest weather art and relevant
metadata, enhancing user engagement and accessibility.
2025-02-19 17:38:49 +08:00
789e9f8d23 feat: migrate AWS configuration to MinIO
- Update SitemapsController to use MinIO credentials
- Modify RefreshSitemapWorker to adapt to MinIO settings
- Change AWS configuration in initializers and storage files
- Add MinIO credentials to credentials.yml.enc

This commit transitions the application from using AWS S3 to MinIO for
storage. It updates all relevant configurations and ensures that the
application can now interact with MinIO seamlessly, including
support for both production and development environments.
2025-02-19 11:31:57 +08:00
9a35dc5563 feat: Update sitemap host configuration
Some checks are pending
Docker / docker (push) Waiting to run
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
The commit updates the sitemap host to point to the production environment.
This is needed so that the sitemap links will point to the correct domain, and the
production environment needs to point to a specific host. The sitemap now uses
the correct host url, and this is the correct config for the current state.
2025-02-17 00:35:46 +08:00
31a2ec373d refactor: Update sitemap configuration to support a new host name
- Modified the host name in the sitemap configuration to support the new domain.
- This commit changes the hostname, and updates the sitemap to reflect the correct host.
- This is done to reflect the correct host on the production server.
- Added the new `public/sitemaps` directory to .gitignore to avoid commits related to this
 directory, and updates the .gitignore.
2025-02-17 00:27:44 +08:00
2042732787 feat: improve worker logging
- Added current time logging to the worker to help debug and
  analyze processing times
- Cleaned up assets initializer file
2025-02-15 12:30:48 +08:00
936db76437 refactor: Improve weather art generation process
- Add formatted_current_time method to City model.
- Modify BatchGenerateWeatherArtsWorker to check local time.
- Update Sidekiq scheduler to run every hour.

This commit improves the weather art generation by considering
local time for image generation and increasing the frequency
of batch processing for testing purposes. The new method
provides formatted time information for each city. This change
ensures that images are generated during daylight hours.
2025-02-15 12:20:24 +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
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
ec8f89e07a feat: add rack-mini-profiler for performance monitoring
- Include 'rack-mini-profiler' gem in Gemfile
- Update Gemfile.lock with the new dependency
- Create initializer for rack-mini-profiler in development

This addition allows for performance monitoring within the
application during development, which can help identify
and address performance issues more effectively.
2025-02-14 10:47:16 +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
be88aebac2 fix: update AI service logging and weather services 2025-02-13 17:21:41 +08:00
80d623b0c2 style: update description in sidekiq scheduler
- Changed description for the 'batch_generate_weather' job from
  'Generate weather arts every 2 hours' to 'Batch Generate weather
  arts'.
- This change provides a more concise description of the job's
  purpose without altering its functionality.
2025-02-13 16:19:33 +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
3237321db3 fix: improve database URL configuration
- Update development database URL to use a fallback
  if no URL is provided in credentials.
- Modify production SMTP password retrieval to use
  dig method for more robust access.

These changes allow for smoother local development and
ensure that the production environment correctly
accesses the SMTP password, enhancing overall stability.
2025-02-11 17:01: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
2511eadd2f style: format unlock_keys for consistency
- Adjusted the spacing in the 'unlock_keys' configuration
- Ensured uniform spacing around array elements

This change does not affect the functionality of the unlock
keys in Devise but improves the consistency of the code
formatting to enhance readability.
2025-02-11 16:43:24 +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
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
92ec81b152 feat: add devise for user authentication
- Include 'devise' gem for user management
- Update database access URLs in configurations
- Refactor schema types from bigint to integer for resource and author IDs
- Enhance geo synchronization by updating region and subregion handling

These changes are aimed at improving the user management functionality while ensuring efficient data handling and connections for production environment.
2025-02-11 11:46:15 +08:00
652107d0ee migrate with countries_states_cities_db 2025-02-08 17:42:50 +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
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
5feaee4922 feat: add sitemap functionality
- Create SitemapsController to serve sitemaps
- Configure AWS S3 storage for sitemaps
- Update routes to include sitemap paths
- Add SitemapsHelper module
- Configure SitemapGenerator with AWS adapter
- Update storage configurations for AWS

This feature adds sitemap functionality to the application, enabling search engines to discover and index its content more efficiently. It includes configuration for AWS S3 storage to host the sitemaps and updates the application's routes to serve them.
2025-01-26 00:07:44 +08:00
ead795266e refactor: simplify sitemap scheduling process
- Removed conditional check for production environment in
  the initializer to ensure the sitemap refresh worker
  always runs at startup.
- Renamed Sidekiq configuration file from sidekiq.yml to
  sidekiq_scheduler.yml to better reflect its purpose.

These changes streamline the initialization process
for scheduled tasks and enhance the clarity of the
configuration files used in the project.
2025-01-25 11:24:44 +08:00
1ca468f9af fix: improve error handling for sitemap task
- Add error handling when scheduling the RefreshSitemapWorker in
  production.
- Log successful scheduling and errors for improved diagnostics.

This change ensures that any issues with scheduling the worker are
logged and can be addressed promptly, enhancing the reliability of
the application in production.
2025-01-25 11:05:53 +08:00
1f35664590 fix: correct conditional for sitemap refresh
- Update the condition to check for 'RAILS_BUILD' environment variable
- Allow RefreshSitemapWorker to run in development/test environments

This change clarifies the logic for executing the sitemap refresh worker by
inverting the condition to allow it to run when 'RAILS_BUILD' is not set,
ensuring proper functionality during development and testing phases.
2025-01-25 11:01:29 +08:00
40631fe95b fix: alter sitemap refresh condition
- Change the condition to prevent sitemap refresh in production when
  `RAILS_BUILD` is set.
- Ensures that the task only runs in development or non-production
  environments, avoiding potential conflicts or wasted resources.

This change helps to streamline the initialization process and enhances
performance by not triggering unnecessary background tasks.
2025-01-25 10:56:13 +08:00
f7c5ae4ee7 chore: conditionally refresh sitemap
- Modified the schedule_tasks.rb initializer to only run RefreshSitemapWorker.perform_async unless RAILS_BUILD environment variable is set
This change optimizes the build process by preventing unnecessary sitemap refreshes during build time, thus improving overall project performance.
2025-01-25 10:54:19 +08:00
742c94ced1 style: update layout of city show view
- Change stats div to be responsive
- Adjust coordinates display format for better readability

This update enhances the layout of the city show view by making
it more responsive and improving the display of weather and
geographical data. Additionally, the startup task for
refreshing the sitemap is now consistently executed,
removing unnecessary complexity.
2025-01-25 10:51:14 +08:00
c37a93bcdf feat: remove trailing newline at end of file
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 trailing newline at end of file in `schedule_tasks.rb`.

- Modify file to remove unnecessary newline at end of file.
2025-01-25 01:55:00 +08:00
7ebf9cefae feat: switch startup task to Sidekiq with Redis cache
- Update schedule tasks to use Sidekiq and Redis
- Improve task scheduling with caching
- Remove unnecessary code and error handling

This change enhances the reliability and performance of the startup task, leveraging the power of Sidekiq and Redis for background job processing and caching. The improvements ensure a smoother and more efficient application startup experience.
2025-01-25 01:49:28 +08:00
dd37e2835b style: add newline at end of schedule_tasks.rb
This commit adds a newline at the end of the 'schedule_tasks.rb' file to comply with the standard coding practices. Proper file formatting helps in maintaining code consistency across the project.
2025-01-25 01:38:35 +08:00
4e1fb58abf feat: prevent startup task from running in development environment
- Updated schedule_tasks.rb to include RAILS_BUILD check
- Improved application startup behavior in development mode

This change ensures the startup task does not run unnecessarily in development environment, reducing application startup time and resources usage.
2025-01-25 01:38:12 +08:00
84c224cf8d feat: add startup scheduling for production
- Schedule RefreshSitemapWorker after initialization
- Implement error handling for scheduling task
- Use Rails cache to prevent multiple tasks running simultaneously

This commit introduces a mechanism that schedules the
RefreshSitemapWorker to run once after the application starts
in production. It ensures that the task does not run
multiple times concurrently by using a cache key.
Error handling is included to log any failures
in scheduling the task, improving overall reliability.
2025-01-25 01:23:04 +08:00
f477f205ab fix: update default host in sitemap generator and refresh sitemap on worker
- update default host in sitemap generator
- refresh sitemap on worker with new host

These changes allow the sitemap to be correctly generated for different environments and to handle the new host correctly, which was the motivation behind this update. No other side effects are expected.
2025-01-23 19:40:08 +08:00
1f47ba59c9 style: format code for consistency
- Ensure consistent use of double quotes for strings in the
  Gemfile and sitemap configuration files.
- Add spaces for better readability in array declarations
  within the RefreshSitemapWorker.

These changes improve the readability of the code without
changing any functionality. Adhering to a consistent coding
style helps maintainability and team collaboration.
2025-01-23 19:03:14 +08:00
a0516f731c feat: add SEO meta tags and sitemap generation
- Introduced `SeoConcern` module to handle SEO meta tags
- Integrated `meta-tags` gem for customizable meta tags
- Created `RefreshSitemapWorker` to automate sitemap updates
- Added relevant meta tags in controllers for weather art and cities
- Configured sitemap generation settings

These changes improve the SEO of the application by ensuring that
pages have appropriate meta tags. Additionally, a sitemap is now
generated and refreshed daily, enhancing site visibility to search
engines.
2025-01-23 19:02:52 +08:00
665f6f29b6 refactor: change Sidekiq route to admin/tasks
- Update route for Sidekiq web interface from '/sidekiq'
  to '/admin/tasks'

This change improves the coherence of the application's routing
by placing the Sidekiq interface under a more descriptive
namespace. It consolidates admin-related tasks under a common
path, enhancing the organization of the routing structure.
2025-01-23 17:34:45 +08:00
bafb90f5fb style: format code style in Gemfile and controllers
- Adjust spacing around the quotes in the Gemfile
- Standardize spacing in the arts_controller for improved readability
- Modify routes file for consistent array formatting

These changes enhance the consistency of code style across the project without altering any functionality or behavior.
2025-01-23 17:33:01 +08:00
3a6d247451 feat: add pagination to weather arts gallery
- Introduce ArtsController with index action
- Create index view for displaying weather arts
- Implement Kaminari for pagination functionality
- Add necessary routes for accessing arts
- Update Gemfile to include Kaminari gem
- Create views for pagination controls

This implementation enhances the Weather Arts Gallery, allowing users to view and navigate through a collection of AI-generated weather arts easily. Pagination controls have been added to improve usability.
2025-01-23 14:10:13 +08:00
2d5521c3dc chore: adjust sidekiq worker schedule
- Update `BatchGenerateWeatherArtsWorker` cron job to run every 1 hour
- This change will result in weather arts being generated more frequently
2025-01-23 09:19:23 +08:00
a2c75ba3c2 feat: cache Docker layers and update dependencies
- Removed unnecessary queue configurations from Sidekiq configuration
- Added 'whenever' gem and its necessary dependencies for adding cron jobs
- Updated Docker workflow to cache Docker layers using actions/cache

This update improves the efficiency of CI/CD pipelines by caching Docker layers, which will help in reducing the time taken for the build process. Additionally, the changes in the Gemfile and the config/sidekiq.yml configuration will enable the project to run cron jobs for tasks like generating weather arts.
2025-01-23 01:37:47 +08:00
e9095ece6e feat: improve Sidekiq scheduling configuration
- Enable dynamic scheduling only if the schedule file exists
- Update the sidekiq.yml to include a new job for batch generation
- Define a cron schedule for the new job to run every 2 hours

This update allows Sidekiq to conditionally enable its scheduler and
introduces a new job that processes weather art batches every two
hours. The change enhances the job management and scheduling
dynamics in the application.
2025-01-23 01:07:39 +08:00
c20ff296eb fix: update Active Job queue adapter to Sidekiq
- Comment out previous queue adapter setting for Solid Queue
- Set Active Job queue adapter to Sidekiq for better performance

This change updates the Active Job queue adapter from Solid Queue to
Sidekiq. This adjustment is intended to improve job processing
performance and reliability in production environments. The previous
adapter setting will be retained as a comment for reference.
2025-01-23 00:51:56 +08:00
08c584b85b chore: rename job classes and update Sidekiq config
- Renamed `BatchGenerateWeatherArtsJob` to `BatchGenerateWeatherArtsWorker`
- Renamed `GenerateWeatherArtJob` to `GenerateWeatherArtWorker`
- Updated Sidekiq configuration to set Redis URL and logger level
- Modified `sidekiq.yml` to use the new worker class names and added queue configurations

These changes help in aligning the class names with their purpose as
workers in Sidekiq, while also ensuring better configuration for
Redis and logging.
2025-01-22 18:47:41 +08:00