Commit Graph

208 Commits

Author SHA1 Message Date
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
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
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
90c491637b refactor: simplify country retrieval logic
- Replace verbose conditional checks with a ternary operator
- Use 'find_by!' for better error handling if country not found
- Maintain the functionality of state creation associated with the country
2025-02-11 10:50:08 +08:00
24597e6320 refactor: update city sync logic with country and state
- Replace country name lookup with country code lookup
- Replace state name lookup with state code lookup
- Change city creation to ensure country association

This update modifies the existing logic for synchronizing city data to
use country and state codes instead of names. This aids in ensuring
more robust data integrity by relying on unique identifiers.
2025-02-11 10:35:41 +08:00
b4eac06227 refactor: streamline geo data syncing process
- Remove unnecessary debug output for country syncing.
- Improve country determination logic by adding checks for
  both country code and country name.
- Ensure state records are associated with the correct
  country ID post-refactor.

These changes enhance the clarity and efficiency
of the geo data synchronization code, making it easier to
maintain and reducing the risk of errors during data
syncing.
2025-02-11 10:30:25 +08:00
febee58d0a fix: correct state syncing logic
- Change output to include country name during state syncing
- Update record creation from `find_or_initialize_by!` to `find_or_create_by!`

This fix ensures that when syncing state data, the output provides
better context by showing the associated country name, and it also
ensures that states are created if they do not already exist, thus
eliminating potential issues with duplicate state entries.
2025-02-11 10:18:24 +08:00
f67ff92ba8 fix: improve country creation logic
- Refactor the country creation process to use a block for setting
  the name attribute.
- Ensure that the name is set explicitly when a new country is
  created with the appropriate ISO code.

This change optimizes the way country records are created and
ensures the name is always correctly assigned during the
creation process.
2025-02-11 10:05:08 +08:00
d3dae4f079 fix: ensure creation and updating of geo data
- Replace `find_or_create_by` and `find_or_initialize_by` with `find_or_create_by!` and `find_or_initialize_by!` for better error handling.
- Use the `update!` method instead of `update` to raise exceptions on failure.
- These changes improve the reliability of geographic data synchronization by ensuring failures are not silently ignored and facilitate easier troubleshooting.
2025-02-11 09:48:54 +08:00
29ad6be241 refactor: simplify region creation and update code attribute
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 from find_or_initialize_by to find_or_create_by for
  regions.
- Set region code to the name instead of nil.

This refactor reduces complexity in how regions are created and
ensures the code attribute is properly populated with the
region's name, enhancing data consistency.
2025-02-10 18:01:41 +08:00
97330fef91 fix: update region name and clear code
- Update region name with data from the input
- Set code to nil to reset any previous values
- Preserve other attributes like translations, flag, and wiki_data_id

This change ensures that region data is updated correctly with the
provided input while eliminating any previous code settings that may
no longer be relevant.
2025-02-10 17:37:11 +08:00
e774b3e736 fix: correct subregion initialization by name
- Change the method of finding or initializing subregions to use
  the name attribute instead of the id.
- This improves accuracy when synchronizing subregion data, as it
  ensures that subregions are correctly matched by name.
- Eliminates potential issues with duplicate IDs if they happen
  to be reused across different data sources.
2025-02-10 17:21:29 +08:00
bafb889144 refactor: change region identification method
- Update the region lookup to use `name` instead of `id`
- This change allows for more flexible region identification
- Improves alignment with potential data structure changes
2025-02-10 17:19:58 +08:00
27100aec24 fix: improve country creation logic
- Change method from find_or_create_by to find and check for nil
- Initialize a new Country object only if none exists

This fix addresses the potential issue where a country
is being unnecessarily created instead of found, improving
the efficiency of the country data synchronization process.
This change also adds clarity to the method's intent by
clearly separating the find and the initialization logic.
2025-02-10 17:07:48 +08:00
3f1e8892f9 chore: update AWS SDK dependencies and improve schema
- Downgraded `aws-sdk-s3` to version 1.170 and updated
  `aws-sdk-core` to 3.211 to maintain compatibility with
  existing code.
- Updated various column types in the database schema
  from `integer` to `bigint` to handle larger values and
  improve data integrity.
- Modified the `sync_geo_data.rake` task to use
  `find_or_create_by` for `Country`, improving the logic
  for ensuring unique countries based on ISO code.

These changes enhance dependency management and improve
schema robustness while maintaining functionality.
2025-02-10 14:43:34 +08:00
edbfb32d65 feat: update database schema
Some checks are pending
Docker / docker (push) Waiting to run
- Add emoji_u column to countries table
- Add flag column to cities table
- Change default value of active column in cities table

This feature adds several new columns to the database schema, including an emoji_u column to the countries table and a flag column to the cities table. It also changes the default value of the active column in the cities table to false.
2025-02-09 21:55:47 +08:00
9df9f2cd91 refactor: remove active column from cities table
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
- Eliminate the 'active' column from the 'cities' table

This change streamlines the database schema and reduces
unnecessary fields, which may improve performance in
queries and data manipulation related to the cities table.
2025-02-08 17:58:01 +08:00
ddfd1fa807 refactor: simplify countries migration by removing columns
- Remove `region` column from `countries` table
- Remove foreign key reference for `region`

This change simplifies the database migration by omitting fields that are no longer necessary, improving the structure of the `countries` table for future operations.
2025-02-08 17:53:52 +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
1790b2d50c chore: update Dockerfile to include libvips42
- Added libvips42 to the package installation list in the Dockerfile
- Ensures availability of the required library for image processing

This update ensures that all necessary libraries are included,
which may improve the functionality of any image processing features
in the application. It minimizes potential runtime errors related
to missing dependencies.
2025-02-05 14:45:30 +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
d69a193e6d refactor: consolidate Docker build process
Some checks failed
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Docker / docker (push) Has been cancelled
- Removed unused Dockerfile.base and Dockerfile.build.
- Combined build steps into the main Dockerfile for improved clarity and maintenance.
- Updated base image references accordingly.

This change streamlines the Docker build process by reducing the number of Dockerfiles and improving the clarity of dependency management.
2025-02-02 00:44:36 +08:00
2c72e96977 feat: switch to using official ruby slim image
Update the Dockerfile to use the official ruby slim image, rather than a custom image. This reduces the Docker image size and improves build times.

- Update the base build and development images to use the official ruby slim image
- Remove redundant arguments in the build and development stages

Using the official ruby slim image simplifies the build process and reduces the image size, resulting in faster build times and a more maintainable Dockerfile.
2025-02-02 00:40:59 +08:00
378530cc1b feat: automate base image build for GitHub Actions
- Added new GitHub Actions to docker-main.yml to build and push base images
- Created a new Dockerfile.base with the base packages installation
- Modified the existing Dockerfile to use the new base image
- Created a new Dockerfile.build with the build stage to reduce the size of the final image
2025-02-02 00:38:11 +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
dependabot[bot]
31bd6fd74e build(deps): bump solid_cable from 3.0.5 to 3.0.7
Bumps [solid_cable](https://github.com/rails/solid_cable) from 3.0.5 to 3.0.7.
- [Release notes](https://github.com/rails/solid_cable/releases)
- [Commits](https://github.com/rails/solid_cable/compare/v3.0.5...v3.0.7)

---
updated-dependencies:
- dependency-name: solid_cable
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 14:47:06 +08:00
dependabot[bot]
e36448e6d7 chore(deps): bump solid_queue from 1.1.2 to 1.1.3
Bumps [solid_queue](https://github.com/rails/solid_queue) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/rails/solid_queue/releases)
- [Commits](https://github.com/rails/solid_queue/compare/v1.1.2...v1.1.3)

---
updated-dependencies:
- dependency-name: solid_queue
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 14:46:56 +08:00
dependabot[bot]
11df3a31d1 chore(deps): bump puma from 6.5.0 to 6.6.0
Bumps [puma](https://github.com/puma/puma) from 6.5.0 to 6.6.0.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v6.5.0...v6.6.0)

---
updated-dependencies:
- dependency-name: puma
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-01 14:46:42 +08:00