Commit Graph

318 Commits

Author SHA1 Message Date
5f98d9ebfd feat: enhance language switcher dropdown
- Update dropdown to support dynamic locales from I18n
- Limit dropdown height with overflow handling for better UX

This change improves the language switcher by dynamically
loading available locales from the I18n configuration. It
also enhances the user experience by limiting the height
of the dropdown and enabling scrolling, making it easier
to navigate through multiple language options.
2025-02-24 15:55:01 +08:00
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
b2cc7e7016 chore: update keywords for SEO optimization
- Refactor keywords in cities_controller.rb
- Refactor keywords in weather_arts_controller.rb
- Refactor keywords in application.html.erb

This change improves the SEO of the application by updating
keywords to include 'ai' and 'ai web', which are more relevant
and likely to enhance search visibility. The previous keywords
were less optimized for current trends in AI-related searches.
2025-02-24 14:12:51 +08:00
da2f4f6c86 fix: update keywords for better SEO
- Modify keywords in cities_controller.rb to include 'ai weather'
- Update keywords in weather_arts_controller.rb to include 'ai weather'
- Change keywords in application.html.erb to include 'ai weather'

These changes enhance the search engine optimization (SEO) of the
application by ensuring that relevant keywords are included in
meta tags, improving visibility for users searching for AI
weather-related content.
2025-02-24 14:10:32 +08:00
3661d2b008 chore: update meta keywords for SEO
- Modify keywords in CitiesController for better
  categorization of AI art and weather art.
- Update keywords in WeatherArtsController to include
  city country name and description.
- Add keywords in application layout for overall site
  SEO improvement.

These changes aim to improve search engine visibility
and better describe the content related to AI-generated
weather art.
2025-02-24 14:08:25 +08:00
0e476b546d feat: add locking mechanism to batch task worker
Some checks failed
Docker Dev / docker (push) Has been cancelled
CI / scan_ruby (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
Docker Main / docker (push) Has been cancelled
- Introduce a Redis-based lock to prevent concurrent execution of
  batch generation tasks.
- Set a TTL of 300 seconds for the lock to ensure it is released
  after a timeout.
- Add logging for situations where a task is already in progress.

This enhancement ensures that batch tasks do not overlap, which can
lead to data inconsistencies and resource contention. The locking
mechanism improves the reliability of the batch processing system.
2025-02-22 15:41:42 +08:00
d331a73a85 fix: update html lang attribute for I18n
- Change the lang attribute of the HTML tag to use the current I18n locale
- This change ensures that the application correctly reflects the user's language preferences

Updating this attribute improves accessibility and SEO by helping search engines and assistive technologies better understand the language of the content.
2025-02-22 15:19:40 +08:00
5a82fc9a10 style: correct string split style
- Change string split method from single quotes to double quotes.

This commit improves code consistency by aligning the string
split syntax with the rest of the codebase. No functional
changes were made as a result of this update.
2025-02-22 15:00:37 +08:00
926ba18e85 refactor: change locale handling to around_action
- Update set_locale method to use around_action instead of before_action.
- Modify locale extraction logic to handle more cases, ensuring better fallback handling.
- Improve overall method clarity and maintainability by restructuring code.

This change enhances the localization process by providing a clearer
way to manage locale settings and ensures that it correctly falls back
to the default locale when necessary. It also resolves some edge cases
in locale extraction based on the HTTP_ACCEPT_LANGUAGE header.
2025-02-22 15:00:22 +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
5b996bb64a style: update layout and improve accessibility
Some checks are pending
Docker Dev / docker (push) Waiting to run
- Adjust footer components for better spacing
- Move language switcher to navbar for easier access
- Simplify language switcher links using iteration
- Enhance copyright text to dynamically reflect the current year
2025-02-22 01:03:40 +08:00
80ceac5d94 feat: add locale extraction and sanitization methods
- Implemented `extract_locale_from_accept_language_header` to
  retrieve the user's preferred language from the request.
- Added `sanitize_locale` for validating and sanitizing locale
  inputs against available locales.
- Updated `set_locale` method to prepare for incorporating
  browser language preference handling.

These changes enhance the application's ability to set the locale
based on the user's browser settings, paving the way for better
internationalization support.
2025-02-22 00:13:35 +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
517e3038cc chore: rename docker workflows and clean up city seeds
- Rename docker workflow files for clarity: 'docker-dev' and 'docker-main'
- Remove unused city seed files to streamline the database seeding process

These changes improve the organization of the workflow files and reduce clutter in the seed data, making it easier to manage and maintain the project.
2025-02-21 10:02:36 +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
c35f09660a fix: handle nil safely for latest arts image
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
- Update image tag to safely access the first latest art
- Use safe navigation operator to prevent potential nil errors

This change ensures that if there are no latest arts or if the
image is not attached, the application will not raise an error.
It improves the robustness of the view by handling edge cases.
2025-02-19 14:18:14 +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
468a665354 style: update badge classes for weather art display
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
- Change badge class from 'badge-neutral' to 'badge-ghost' for
  better visual consistency.
- This update improves the UI by aligning the badge styles with
  the overall design language of the application.
2025-02-18 17:00:49 +08:00
9a02115562 feat: enhance weather art display layout
- Update background color for better visibility
- Adjust padding and margins for improved spacing
- Refactor card components for a cleaner design
- Add AI Prompt section for better user engagement

These changes improve the overall user experience by making the
weather art display more visually appealing and easier to
navigate. The layout adjustments also enhance the mobile
view, ensuring a consistent experience across devices.
2025-02-18 16:54:17 +08:00
fc721ada9f Refactor: Limit images generation
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
- Modify the `PER_RUN_ION` constant of `BatchGenerateWeatherArtsWorker` from
  3 to 2, reducing the number of images generated on each run.

- This change reduces the limit and will not affect other parts
  of the application.
- It is about reducing the number of images generated per run and
  will impact the performance of the application.
- It will not affect the other parts.
</commit_message>
2025-02-17 23:21:04 +08:00
888dc7f22d feat: add Redis integration for sitemap refresh
- Include Redis gem in the Gemfile and update Gemfile.lock
- Implement locking mechanism in the RefreshSitemapWorker to prevent concurrent executions
- Use Redis to manage distributed locks for the sitemap generation process

This change introduces Redis for managing access controls in the sitemap
refresh workflow. It prevents multiple simultaneous jobs from running,
improving stability and performance when generating sitemaps.
2025-02-17 15:07:34 +08:00
f79299d707 feat: update art listings in home controller
- Modify the popular arts query to include city and country relationships
- Ensure the latest arts query also includes necessary associations
- Removed deprecated commented code for clarity

These changes improve data retrieval by establishing better relationships to
cities and their countries. This enhances the availability of data for
the views rendering the arts and keeps the code clean by removing
unnecessary comments.
2025-02-17 14:38:29 +08:00
81116a2f3e chore: update sitemap default host to use ENV variable
- Change default_host assignment to use ENV.fetch for
  RAILS_SITEMAP_DEFAULT_HOST
- This allows for easier configuration based on the environment,
  particularly useful for production and development setups.
2025-02-17 14:08:31 +08:00
df86a10f03 fix: correct logic for weather arts selection
- Update query to select weather arts with last generation time
  greater than the cutoff time.
- Adjust logging for clarity, including brackets around limits
  and counts for better readability.
- Change from appending to selected cities to concatenating selected
  cities, ensuring the full list is preserved.

This commit resolves an issue where the logic for filtering
recent weather arts was incorrect, potentially leading to missing
relevant entries. Additionally, it improves log output formatting
for better debugging.
2025-02-17 13:29:31 +08:00
4ea7f6c03c fix: update sitemap default host
- Change default host for SitemapGenerator from local server
  to the new public URL. This allows the sitemap to be
  generated correctly in the production environment.
- Ensures that the sitemap points to the correct domain, improving
  search engine visibility and indexing.
2025-02-17 13:18:57 +08:00
269e5ef553 refactor: improve logging in weather arts worker
- Added logging for skipped recent cities.
- Enhanced logging for selected cities after filtering.

This refactor improves the observability of the city selection
process in the BatchGenerateWeatherArtsWorker. The added logs
provide better insight during debugging and monitoring, allowing
developers to track recent selections and identify any issues
related to city filtering more effectively.
2025-02-17 13:15:16 +08:00
104597e3ba feat: improve city selection for weather arts generation
- Introduce `get_recent_cities` to filter out cities that have been recently generated weather arts.
- Update `select_cities` method to exclude recent cities from the selection process, ensuring diversity in the generated arts.
- Modify the `select_countries` method to maintain its functionality while integrating recent city filtering.

This update enhances the system's ability to select active cities efficiently, reducing redundancy and improving the variety of generated weather arts by avoiding recent candidates.
2025-02-17 12:58:16 +08:00
f1815afc41 feat: improve city selection logic in weather worker
- Refactor city selection to better optimize the process
- Implement debugging logs for clearer tracking of city selection
- Modify logic to fairly distribute remaining city slots across countries

These changes enhance the efficiency of the city selection process
while providing useful debug information to track operations. The new
logic ensures that cities are selected based on activity status and
spreads the selection across provided countries if additional slots
are available. This improves the probability of including diverse
cities in the generation process, reducing potential bias in
selection.
2025-02-17 11:51:45 +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
f02587da57 feat: improve weather art display and generation
- Display the latest weather art on the cities index page.
- Update the weather art preview image size to be big.
- Improve image display by using webp format.
- Adjust the daily and per-run generation limits.

These changes enhance the user experience by providing more
up-to-date and visually appealing content, while also controlling
the resource usage during image generation.
2025-02-17 00:15:32 +08:00
fa1fc7c21a refactor: improve weather art generation process
- Update city selection to consider countries.
- Use daytime instead of sunrise for time checks.
- Add per-run generation limit

This commit refactors the weather art generation process to
increase the efficiency. The city selection has been updated to
consider country. Daytime check has been updated to determine
if the city is within the correct local time. A limit is added
to restrict the number of cities processed in a single run.
2025-02-16 22:59:53 +08:00
afc871deb1 refactor: improve: changes in admin panel
The commit message implements a new feature
in the admin panel for the Sidekiq tasks
allowing users to input the city ID. The
previous implementation uses a selection approach
where users can input the city ID.
The new feature allows for a more streamlined,
direct data input method for the users.
</commit_ message>
2025-02-16 13:42:13 +08:00
0ef979e5c4 feat: refactor: change image generation quality
- Modify the code to use the `hd` quality setting
- Update the code to use the `hd` quality setting.
- Ensure there are no other side effects of this change.
- These changes will improve the user experience.
</commit_message>
2025-02-16 13:27:25 +08:00
e5930c666b feat: rename social media website, including X/Twitter
The commit renames the social sharing feature on
the website. Before the renaming the text was labeled as
'Twitter' and now it has been renamed to 'X/Twitter'.

Motivation:
- To change the presentation of the page.
- To improve the experience of the user.
- To show the correct name of the platform.
</commit_message>
</git_diff>
</commit_message>
2025-02-16 12:12:29 +08:00
3f8b0dd231 feat: implement social sharing functionality
- Added `share_controller.js` to handle sharing logic.
- Created `_share_social.html.erb` partial for social sharing buttons.
- Integrated share buttons into city and weather art show pages.
- Added sharer.js dependency.

This feature allows users to share city and weather art pages on
various social media platforms such as Facebook, Twitter, LinkedIn,
Pinterest, Telegram, and WhatsApp, increasing content visibility.
2025-02-16 11:58:25 +08:00
d4deddbb8c feat: fetch city state information
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
- Added state association to City model
- Modified City view to display state information

This change includes proper input validation and error handling.
Added city state information to views and models to improve data accuracy and user experience.
2025-02-16 01:35:36 +08:00
6f2a42b92b refactor: prioritize latest arts over featured
- Comment out featured arts in home controller
- Update index.html.erb to display latest arts instead of featured

This change aims to keep the displayed arts up-to-date and fresh by showing the latest ones, enhancing user experience by providing more current content.
2025-02-16 01:14:25 +08:00
0af41e24a8 feat: fix: generate weather art
Add logging for the daily generated counts

The change log adds a log statement to display the
count of slots generated.
The code change includes two parts:
*   a debug log of
    number of slots generated and
    the number of
    generation slots
*   a change that generates the
    number of
    art per day
    to the
    user's log
    informing
    the art generated.
The logs are added for monitoring.
The log
statement outputs the
number of generated art and the limit.
</commit_message>
2025-02-16 01:08:49 +08:00
2f84dde40f refactor: remove random arts from homepage
The code refactoring is done by commenting out the random art functionality from the index page and removing the corresponding code from the home_controller. This eliminates the need for a random art display, simplifying the application's behavior.

This also fixes a bug where it was showing random arts and makes it so the application runs more efficiently since it's not calling the unnecessary code anymore.
2025-02-15 17:47:44 +08:00
abdb40e4bf refactor: fix: timezone format issue
The commit fixes issues in the `Country` model to properly handle
timezones when it's a string. The change processes the content and
parses it as JSON data, and fixes an issue with JSON format.

- The `format_timezones` method now attempts to parse and reformat
  timezones to prevent potential JSON parsing errors.
- If the conversion to JSON fails, logs the error.
- The code ensures data integrity
  by parsing and reformatting the JSON for timezone data to solve a
  bug.
</commit_message>
</commit_message>
</commit_message>
  This ensures the data is correctly formatted for easier handling
  and prevents potential runtime errors when reading timezone data.
</commit_message>
2025-02-15 17:32:43 +08:00
eb9bfc7972 feat: add auto ad to city page and weather art
The auto ad is added to the city page and the weather art page. It improves user experience by showing relevant ads to the user. This change should not affect performance as it only modifies the view.

- Add auto ad in city page and weather art page.
- Refactor shadow effects to improve user experience.
- No side effects or any other consequences.
2025-02-15 17:30:29 +08:00
5e716a46d9 fix: parse timezones as JSON
- Updated timezone parsing to handle JSON format.
- Modified how timezones are fetched in multiple models.
- Added a migration to convert existing timezones data.
- Modified the country model to format timezones.

This commit fixes an issue where the timezone data was not
being correctly parsed, leading to potential errors in time
calculations.  The changes ensure the application correctly
handles and displays timezone information, improving the
accuracy of time-related features.
2025-02-15 17:21:02 +08:00
2ffb1a4248 refactor: Convert country timezones to JSON and handle errors
This commit refactors the database migration to convert the
timezones for each country in the database to a JSON format.
It addresses an issue where the timezone data was not properly
formatted. It provides a default value if there's an error to avoid
data loss. It also includes error handling to catch and log exceptions
during the migration process, preventing the entire migration from failing.
2025-02-15 16:54:59 +08:00
ca3691004f feat: Convert country timezones to JSONB format
- Changed `timezones` attribute from text to JSONB in `Country`.
- Updated related model methods to handle JSONB data.
- Added a migration to convert existing timezone data.
- Used safe navigation operators to prevent errors.

This change improves the storage and management of timezone
information by using the JSONB data type.  It includes data
migration to handle existing timezone data.
2025-02-15 16:51:36 +08:00
983564d534 feat: add auto ad integration
- Add a new file to render the ad.
- Modify `app/views/cities/show.html.erb` to render
 the ad.
- The change is to add a new feature to the ad.
2025-02-15 16:39:17 +08:00
98a335100b refactor: move map partial to shared directory
- Renamed `app/views/cities/_map.html.erb` to
  `app/views/shared/_map.html.erb`
- Updated references to the map partial in `cities/show.html.erb` and
  `weather_arts/show.html.erb`
- Adjusted the layout in `cities/show.html.erb` and
  `weather_arts/show.html.erb` for visual consistency.

This refactoring improves code reusability and maintainability by
centralizing the map component. It also improves the visual
presentation of the application.
2025-02-15 16:32:58 +08:00
67dcaf7a9d Merge branch 'dev' 2025-02-15 16:15:14 +08:00