Commit Graph

180 Commits

Author SHA1 Message Date
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
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
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
73dcd4df6a refactor: update weather art display logic
This commit updates the map functionality to ensure the weather art's
display is correctly rendered. This includes modifications to the
weather art display. It ensures the correct image is shown and improves
the overall application experience.
2025-02-15 16:14:06 +08:00
299107b988 feat: modify logging level of batch job worker
The logging level of the batch job worker has been changed from info to debug. The change affects how the batch job worker outputs information about the cities it is processing.

- Original behavior: The batch job worker logs cities' information at the info level.
- New behavior: The batch job worker logs cities' information at the debug level.

The motivation behind this change is to reduce the noise in the logs. The new behavior will only log cities' information that is relevant for debugging purposes.
2025-02-15 12:32:04 +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
df074a81a8 fix: access city attribute correctly in WeatherArt model
- Modified the formatted_time method to use 'self' when accessing the city attribute
- This change fixes a bug where the city attribute was not being accessed correctly, ensuring proper timezone information retrieval.
2025-02-15 12:01:19 +08:00
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