Commit Graph

377 Commits

Author SHA1 Message Date
11d7adba99 chore: comment out unused popular arts section
- Comment out the popular weather art rendering and related titles in
  the home index view.
- Keep the latest weather art section active for display.

This change removes sections of code related to popular and random
weather art, which are not currently in use, while preserving a
clean interface for the latest weather art.
2025-04-08 11:14:00 +08:00
6e07435474 chore: remove unused analytics scripts
- Deleted LA_COLLECT script and initialization code
- Removed any references to unused analytics resources

These changes clean up the application layout by removing
scripts that were no longer in use, potentially improving
load times and reducing unnecessary code complexity.
2025-04-08 11:10:29 +08:00
d79e205c54 chore: update brakeman to version 7.0.2
- Update brakeman gem from version 7.0.0 to 7.0.2
- This update includes security fixes and performance improvements.

Keeping gems up to date helps maintain security and improves overall
performance of the application.
2025-04-07 17:36:39 +08:00
0dc47e4a92 feat: add LA data collection script
- Include SDK script for user activity collection
- Initialize SDK with specific IDs

This change integrates a data collection tool into the
application, allowing for improved tracking of user
interactions. The SDK will help gather actionable insights
for enhancing user experience.
2025-04-07 17:31:36 +08:00
435244777c style: simplify wiki data badge display
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
- Removed unnecessary div wrappers from the wiki data badge
- Cleaned up the code for better readability

This change enhances the markup simplicity without affecting the functionality,
ensuring the badge displays correctly while maintaining the same styling.
2025-04-02 15:37:51 +08:00
75e7004da6 style: update badge styling for wiki data display
- Change badge class from 'badge-ghost' to 'badge-info'
- Adjust the badge to have a softer appearance

This update improves the visual clarity of the wiki data badge, making it
more consistent with the overall design while ensuring the functionality
remains unchanged.
2025-04-02 15:27:52 +08:00
ddc10e9679 style: update wiki data badge layout
- Wrap badge content in a div for better layout.
- Maintain existing functionality and styling while improving structure.

This change enhances the HTML structure of the wiki data badge by
encapsulating the link in a div element, which aids in layout
management without altering the way the component functions or
displays.
2025-04-02 15:25:46 +08:00
025ee0d06a fix: correct rendering syntax for wiki data badge
- Updated rendering syntax in 'show' view for cities
- Updated rendering syntax in 'show' view for weather arts

These changes ensure that the 'wiki_data_badge' partial is rendered
correctly in both views, improving the consistency of the code
and fixing potential display issues caused by the previous syntax.
2025-04-02 15:06:02 +08:00
1cc1af0ff2 feat: extract wiki data badge into a shared partial
- Replace inline wiki data badge code with a render call to a new
  shared partial.
- This change promotes code reuse and simplifies the view
  templates for cities and weather arts.
- The shared partial handles the condition for displaying the badge
  based on the presence of `wiki_data_id`.

This refactor enhances maintainability and adheres to DRY
principles, allowing for easier updates or changes to the wiki
badge display in one location instead of multiple views.
2025-04-02 14:54:49 +08:00
3bfc64b0c8 feat: add translations for wiki data in locales
- Add translation for 'wiki_data' in Arabic
- Add translation for 'wiki_data' in Bengali
- Add translation for 'wiki_data' in German
- Add translation for 'wiki_data' in English
- Add translation for 'wiki_data' in Spanish
- Add translation for 'wiki_data' in Persian
- Add translation for 'wiki_data' in French
- Add translation for 'wiki_data' in Hindi
- Add translation for 'wiki_data' in Croatian
- Add translation for 'wiki_data' in Italian
- Add translation for 'wiki_data' in Japanese
- Add translation for 'wiki_data' in Korean
- Add translation for 'wiki_data' in Polish
- Add translation for 'wiki_data' in Portuguese
- Add translation for 'wiki_data' in Russian
- Add translation for 'wiki_data' in Turkish
- Add translation for 'wiki_data' in Ukrainian
- Add translation for 'wiki_data' in Urdu
- Add translation for 'wiki_data' in Chinese (Simplified)

This update provides localized support for the term 'wiki_data' across multiple languages, improving user experience and accessibility in international environments.
2025-04-02 14:43:03 +08:00
73c73a2a9e feat: add WikiData link to city details
- Include a link to the city's WikiData page if available
- The link opens in a new tab and has a tooltip for better user experience

This change enhances the city details page by providing
users with easy access to additional information about the
city on WikiData, improving overall user engagement
and knowledge access.
2025-04-02 14:36:31 +08:00
a4fc4d4961 fix: handle image loading errors in views
- Wrap image_tag calls in begin-rescue blocks to catch loading errors
- Log any exceptions to Rails logger for better debugging
- Provide user feedback with a placeholder when images fail to load

These changes improve the robustness of the application by ensuring that errors do not cause disruptions in the user interface.
2025-03-25 17:21:19 +08:00
b33552f6b1 fix: add error handling for image loading
- Implemented error handling for image loading to prevent application
  crashes when an image fails to load.
- Added logging to capture the error message when an image cannot be
  displayed.

This change improves the reliability of the image display feature on
the home page, ensuring that users are not met with a broken layout
if an image fails to load.
2025-03-25 17:15:19 +08:00
6b3d290c4e feat: add download card for weather arts
- Create a download card component for weather arts
- Include options for premium purchase, medium quality, and a free WebP version
- Ensure proper layout and styling for the download options

This addition enhances the user experience by providing a clear
and organized way to download various versions of the weather
art. It also includes functionality for both paid and free
options, addressing different user needs.
2025-03-24 17:31:05 +08:00
c27bab7dc9 refactor: simplify weather art creation process
- Moved weather art creation inside the transaction block
- Updated variable names for clarity
- Ensured the transaction block manages the creation and attachment of images more clearly

This refactor improves the readability and maintainability of the
`create_weather_art` method while preserving its original
functionality. The changes also ensure that the transaction
affects the creation and attachment operations coherently.
2025-03-22 11:29:54 +08:00
c489c19467 chore: set S3 bucket ACL to private
- Update AWS S3 adapter configuration to set the
  access control list (ACL) to private for both
  production and development environments.
- This ensures that the sitemap files are not publicly
  accessible and are only retrievable by authorized
  users or applications, improving security.
2025-03-22 11:11:50 +08:00
2e635972b2 fix: update s3 endpoint for compatibility
- Switch to the new s3 endpoint for improved access
- Comment out the previous internal endpoint for clarity

This change updates the s3 endpoint to ensure proper
connection and compatibility with the service. The
internal endpoint is commented out to avoid confusion.
2025-03-22 08:59:05 +08:00
a5bd4c7da9 chore: update S3 bucket name for development
- Change bucket name from today-ai-weather-hk-dev to
  today-ai-weather-dev-hk
- Update the configuration for easier understanding and
  consistency

This update modifies the S3 bucket name used in development
settings, improving clarity and aligning with naming
conventions.
2025-03-21 23:50:56 +08:00
06f4a10398 chore: update s3 configuration for new region
- Change the AWS S3 region from Hong Kong to Shanghai for
  both production and development environments.
- Update bucket names to reflect the new region.
- Modify the endpoint URLs to align with the new settings.

These changes ensure that the application interacts with the
correct resources in AWS and maintains compatibility with
services hosted in Hong Kong.
2025-03-21 23:16:37 +08:00
d4141c7639 Merge branch 'dev' 2025-03-16 00:19:28 +08:00
3c8389f977 chore: update database connection URLs
- Comment out the previous development database URL
- Implement a new PostgreSQL URL for production use

This change updates the database connection settings to ensure
that the application connects to the appropriate database in
different environments. Commenting out the old URL helps
prevent accidental usage while retaining it for reference.
2025-03-16 00:15:09 +08:00
f2e2c8c4d8 refactor: update AWS S3 credentials configuration
- Modify AWS credentials to use 's3' instead of 'minio' for both production and development environments.
- Update associated initializers, environment configurations, and sitemap generator settings.
- Simplify the configuration retrieval by aligning with new standards for S3.

These changes ensure consistent access to AWS S3 resources and improve maintainability by aligning with updated environment variable practices.
2025-03-16 00:13:37 +08:00
2f33f92f49 fix: handle weather art generation errors properly
- Ensure created weather art is deleted if an error occurs
- Log detailed error messages for better debugging

This change improves the stability of the weather art
generation process by ensuring that failed operations
release resources properly, preventing potential
memory leaks or database clutter.
2025-03-15 23:16:21 +08:00
0a75ea9bd5 fix: ensure weather art images are processed
- Moved image processing to after the weather_art assignment.
- This change guarantees that the webp and preview images are processed before returning the weather_art object.
- Resolves potential issues where image processing wouldn't occur if the returned value wasn't properly assigned initially.
2025-03-15 20:39:46 +08:00
257d802fe3 fix: process weather art images correctly
- Add processing for webp_image and preview_image

This fix ensures that both webp and preview images of the weather art
are processed correctly after generation, resolving issues related to
image availability in the system.
2025-03-15 14:50:15 +08:00
fb6133f736 fix: handle image load errors in arts view
- Wrap image tag with begin-rescue to catch errors
- Display fallback message when image fails to load
- Log error messages to Rails logger for debugging

This change improves the robustness of the image loading
feature in the arts view by handling potential exceptions
when loading images. Users will see a placeholder message
if the image fails to load, enhancing user experience and
ensuring that the application does not crash due to unhandled
image load errors.
2025-03-10 23:55:25 +08:00
44f446c069 fix: adjust timing for weather arts generation
- Increase MAX_DURATION to allow longer processing time.
- Double SLEEP_DURATION to reduce server load between runs.
- Raise PER_RUN_GENERATION_LIMIT to improve throughput.

These changes enhance the performance of the weather arts generation
job by allowing longer intervals and reducing the frequency of
interruptions while also accommodating additional requests per run.
2025-03-06 09:22:40 +08:00
d8a2600998 chore: update sleep duration for weather arts worker
- Increase SLEEP_DURATION from 10 seconds to 60 seconds

This change modifies the sleep duration used in the
BatchGenerateWeatherArtsWorker class, allowing for longer
wait times between executions. This may help prevent
exceeding resource limits during high-demand periods.
2025-03-05 17:53:02 +08:00
2aad3ec5b4 fix: improve tag formatting functionality
- Update `format_as_tag` method to replace hyphens with
  underscores in addition to spaces.
- Ensure the method handles blank inputs properly.

This change improves the consistency of tag formatting by
ensuring that both spaces and hyphens are converted into
underscores, enhancing the usability and reliability of
this helper method.
2025-03-05 16:43:14 +08:00
f4337240f7 feat: enhance tag formatting options
- Update formatting to replace spaces with underscores
- Add functionality to replace hyphens with underscores
- Clarify comments to reflect new formatting behavior

These changes improve the flexibility of the tag formatting method by
allowing both spaces and hyphens to be standardized as underscores,
ensuring consistent tag representations.
2025-03-05 16:36:28 +08:00
9ff27cbe4d fix: correct region and subregion retrieval
- Update region access to use country.region instead of city.region
- Update subregion access to use country.subregion instead of city.subregion

These changes ensure that the region and subregion are accurately retrieved based on the correct geographical hierarchy, improving the data integrity of the application.
2025-03-05 16:26:10 +08:00
5de3d4306f feat: add tag formatting helper 2025-03-05 16:20:08 +08:00
2d227d5871 feat: add region and subregion to RSS feed 2025-03-05 15:55:50 +08:00
789fe06c2a fix: update metadata structure in RSS feed 2025-03-05 15:40:33 +08:00
9dd6fc26f8 feat: add formatted date to RSS feed response
- Include formattedDate in the RSS feed response
- Utilize art.formatted_time method for better date formatting

This change enhances the RSS feed by providing a more user-friendly
formatted date alongside the existing weather date. This allows
clients consuming the RSS feed to display dates in a more readable
format, improving overall usability.
2025-03-05 15:38:53 +08:00
d39a7deea2 feat: update RSS feed routes and logging
- Change route for RSS feed to use defaults for format
- Add logging to RssController#feed to track request format

These changes improve the clarity of the routing for the RSS feed
and enhance debugging capabilities by logging the request format.
The new route definition ensures that the feed responds correctly
with the default format, while the logging provides insight into
how the feed is being accessed.
2025-03-05 15:18:15 +08:00
4e322bd6e9 feat: add JSON feed support for weather art
- Implement JSON feed generation in the RssController
- Add new API endpoint to serve JSON feed
- Update RSS feed view to include hidden machine-readable data

This commit introduces a new feature that allows the application to
serve weather art data in JSON format. The JSON feed includes
metadata such as the title, description, and additional custom
fields for better integration with other services. The changes
also enhance the existing RSS feed by embedding machine-readable
data within the HTML structure, improving accessibility and
usability for automated systems.
2025-03-05 14:59:02 +08:00
e22d3d86de feat: enhance RSS feed with weather data
- Add custom XML namespace for weather data
- Include additional weather fields: country, city, state,
  weather description, prompt, and formatted date
- Update enclosure type to 'image/webp' for better
  compatibility

This update improves the RSS feed by providing more detailed
weather information for each art piece, enhancing the
user experience and ensuring better data representation.
The new fields allow for richer content in the feed, making
it more informative for users.
2025-03-05 14:42:14 +08:00
2b7318a858 feat: optimize RSS feed with eager loading
- Include image attachments and city associations in the
  RSS feed query to improve performance.
- This change reduces the number of database queries
  needed when rendering the feed, addressing potential
  N+1 query problems.
2025-03-05 14:15:31 +08:00
c82af65c26 feat: enhance RSS feed with additional weather data
- Add country name, city name, and state name to the RSS feed
- Include weather description and AI-generated description
- Add weather date to provide more context for each item

These changes improve the RSS feed by providing more detailed
information about the weather art, enhancing the user experience
and making the feed more informative for subscribers.
2025-03-05 13:46:57 +08:00
acbde3b034 feat: add hashtag support to social share button
- Include data-hashtag attribute in the Facebook share button
- Comment out an alternative database URL in credentials

This update enhances the social sharing feature by allowing
users to include hashtags when sharing content on Facebook.
The commented-out database URL serves as a reference for
future configurations.
2025-03-04 14:46:13 +08:00
98094ac0e4 style: standardize role casing in AI service 2025-03-02 11:17:05 +08:00
98f60d270e refactor: remove language switcher from navbar
- Removed the language switcher component from the
  navigation bar.
- This change simplifies the user interface, focusing
  on primary navigation elements.

The decision was made to streamline navigation and reduce
clutter, as the language switcher was deemed not essential
for the current user experience.
2025-02-28 13:23:21 +08:00
30508af344 feat: add pagination parameters to weather arts
- Include region, country, state, and query parameters
  in the pagination helper for better filtering.
- This change enhances the user experience by allowing
  users to navigate through weather arts based on
  specific criteria, improving the relevance of the
  displayed results.
2025-02-26 15:59:39 +08:00
df7fbcd118 feat: enhance city pagination and data fetching
- Update cities controller to include state in city data
- Modify results partial to pass pagination parameters
- Adjust index view to support turbo frame actions

These changes improve the pagination functionality by ensuring
that the correct parameters are passed for filtering cities
based on region, country, and state. This enhances the user
experience by providing more relevant data and better
navigation through the city listings.
2025-02-26 15:31:45 +08:00
070a3dfc1c fix: handle nil state in city initialization
- Update city initialization to safely access state ID
- Use safe navigation operator to prevent potential nil errors

This change ensures that if the state is nil, the code will not raise
an error when trying to access its ID. It improves the robustness of
the city data synchronization process.
2025-02-26 14:44:07 +08:00
f9e86bed27 fix: update city attributes assignment 2025-02-26 14:43:34 +08:00
3da2abbfaa refactor: improve city syncing logic
- Use `find_or_initialize_by` to ensure uniqueness based on
  multiple attributes.
- Replace multiple `update!` calls with `assign_attributes` for
  better readability and maintainability.
- Add error handling for city saving process to log errors
  if saving fails.

These changes streamline the city syncing process, making it
more efficient and easier to understand while ensuring that
cities are created or updated correctly based on unique
attributes.
2025-02-26 14:36:38 +08:00
26f8d56632 feat: add sync_city task for city data synchronization
- Define a new Rake task `sync_city` to synchronize city data
- Update the `find_or_create_by!` method to include additional
  attributes such as `flag`, `wiki_data_id`, `active`, and
  `priority`

This new task allows for better management of city data by
ensuring that all relevant attributes are set during the
synchronization process. It enhances the existing functionality
by providing more detailed information for each city.
2025-02-26 11:58:10 +08:00
e219b53bab refactor: update city creation parameters
- Change country_code to country_id for better clarity
- Add state_id to the city creation process

These changes ensure that the City model is created with the correct
associations to country and state, improving data integrity.
This refactor also enhances the readability of the code.
2025-02-26 11:18:18 +08:00