Skip to content

Add Popup Window Feature#18

Merged
yulmwu merged 4 commits into
mainfrom
feat/popup
Jun 6, 2026
Merged

Add Popup Window Feature#18
yulmwu merged 4 commits into
mainfrom
feat/popup

Conversation

@yulmwu

@yulmwu yulmwu commented Jun 6, 2026

Copy link
Copy Markdown
Member

This PR introduces a popup window feature that displays a popup when users visit the site.

Administrators can register popup images, which will then be displayed to users upon visiting the site. The frontend includes a "Do not show for a day" option, allowing users to hide the popup for 24 hours.

The following APIs have been added:

  • GET /popups
  • POST /popups
  • PUT /popups/{id}
  • DELETE /popups/{id}
  • POST /popups/{id}/image/upload
  • PUT /popups/{id}/image
  • DELETE /popups/{id}/image

Image uploads use the S3 Media Store.

Previously, this storage was used primarily for profile images (/profiles/). Since it is intended as a dedicated media storage location, popup images are stored under the /popups/ path.

For more details, please refer to the updated source code and API documentation.

@yulmwu yulmwu added the enhancement New feature or request label Jun 6, 2026
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.05952% with 67 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/service/popup_service.go 73.29% 27 Missing and 24 partials ⚠️
internal/repo/popup_repo.go 75.00% 5 Missing and 5 partials ⚠️
internal/http/handlers/handler.go 93.87% 4 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a site-wide popup feature: admins can create/manage popups with images stored in the S3 media store (under popups/), and end-users see an on-visit popup carousel with a “hide for 24 hours” option.

Changes:

  • Add popups persistence (model/repo/service), plus DB auto-migration/index + SQL migration scripts.
  • Add HTTP endpoints for public “active popups” and admin CRUD + image upload/finalize/delete flows, with integration/handler/service/repo tests.
  • Add frontend admin UI for managing popups and a user-facing popup carousel, plus shared mediaURL() helper + i18n updates.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
migrations/2026-06-06/999_rollback.sql Rollback script for removing popups table.
migrations/2026-06-06/001_add_popups.sql Forward migration creating popups table + index.
internal/storage/s3_media_test.go Updates storage test to use the renamed in-memory media store.
internal/storage/memory.go Renames in-memory store to a generic media store and updates presign URL.
internal/service/vm_service_test.go Uses t.Context() for TTL reaper tests.
internal/service/testenv_test.go Wires popup repo/service into the service test environment and truncation list.
internal/service/popup_service.go Implements popup business logic + image upload lifecycle.
internal/service/popup_service_test.go Adds unit tests for popup service behavior and validations.
internal/service/errors.go Adds ErrPopupNotFound.
internal/service/community_service_test.go Updates loop style for seeding likes.
internal/repo/testenv_test.go Adds popups to repo test DB truncation list.
internal/repo/popup_repo.go Adds Bun repo for popup CRUD + active listing query.
internal/repo/popup_repo_test.go Adds repo integration tests for popup CRUD + active list.
internal/repo/community_repo_test.go Updates loop style for seeding likes.
internal/models/popup.go Adds models.Popup DB model.
internal/http/router.go Wires popup handlers + registers public/admin popup routes.
internal/http/integration/testenv_test.go Wires popup repo/service into HTTP integration env and router construction.
internal/http/integration/popups_test.go Adds end-to-end tests for popup endpoints and auth/validation.
internal/http/integration/community_test.go Updates loop style for like-threshold test setup.
internal/http/handlers/types.go Adds request/response DTOs for popups + mapping helpers.
internal/http/handlers/testenv_test.go Wires popup service into handler test environment.
internal/http/handlers/handler.go Adds popup handler methods + updates handler constructor signature.
internal/http/handlers/handler_test.go Adds handler-level popup endpoint tests and updates constructor call sites.
internal/http/handlers/errors.go Maps ErrPopupNotFound to HTTP 404.
internal/db/db.go Adds popup model to auto-migrate and creates popup index.
frontend/src/routes/admin/Popups.tsx Admin UI for listing/creating/updating/deleting popups and uploading images.
frontend/src/routes/Admin.tsx Adds “Popups” tab and renders admin popup management page.
frontend/src/locales/ko.json Adds admin + popup carousel strings (Korean).
frontend/src/locales/ja.json Adds admin + popup carousel strings (Japanese).
frontend/src/locales/en.json Adds admin + popup carousel strings (English).
frontend/src/lib/types.ts Adds popup-related API types.
frontend/src/lib/media.ts Adds shared mediaURL() helper for S3 media CDN URLs.
frontend/src/lib/api.ts Adds popup API client functions.
frontend/src/components/UserAvatar.tsx Switches avatar CDN URL building to shared mediaURL().
frontend/src/components/PopupCarousel.tsx Adds user-facing popup carousel with “hide for a day” behavior.
frontend/src/App.tsx Mounts popup carousel globally.
docs/docs/admin.md Documents popup endpoints and image upload flow.
cmd/server/main.go Wires popup repo/service into server startup and router creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/2026-06-06/001_add_popups.sql
Comment thread internal/http/handlers/types.go Outdated
Comment thread internal/service/popup_service.go
yulmwu and others added 3 commits June 6, 2026 22:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@yulmwu yulmwu merged commit 6680337 into main Jun 6, 2026
1 of 2 checks passed
@yulmwu yulmwu deleted the feat/popup branch June 6, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants