Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

アンケートポップアップを追加 #283

Merged
merged 9 commits into from
Jun 11, 2024
Merged

Conversation

Shvain
Copy link
Member

@Shvain Shvain commented Jun 7, 2024

概要

✅️ホーム画面ロード時にポップアップウィンドウを表示
✅️一度閉じた時に再度表示しないようにする

プレビュー

image

Copy link

vercel bot commented Jun 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lounas ✅ Ready (Inspect) Visit Preview Jun 10, 2024 3:35pm

@Shvain Shvain added the Feature: New New features label Jun 7, 2024
@wiyco wiyco added the Status: In Progress In Progress status label Jun 7, 2024
@wiyco
Copy link
Contributor

wiyco commented Jun 8, 2024

❌ 一度閉じた時に再度表示しないようにする

これ難しそうなので、参考になりそうなのをメモしとく。

今のところ思いついた方法は2つある。

  1. local storageを使う
  2. cookieを使う

それぞれのメリット

1. local storageを使う

一番のメリットは、導入が簡単なことだと思う。
今の/homeページはクライアント(use client)のコンポーネントなので、そのままuseCallbackなりuseEffectなりで、local storageを操作すれば良さげ。
懸念点は「ユーザーが自らブラウザのキャッシュを削除しない限り、設定した値は永遠に残る」ところかな。

2. cookieを使う

ここで敢えてcookieを選ぶメリットはあんまりない。
が、cookieはコードで値の有効期限をコントロールできるのが良い。(localStorageはできない)
ただし、Next.jsはcookieをサーバーコンポーネント(use clientなし)でしか使えないので、ビューとビジネスロジックを分離する必要がある。
コスト高め。

Note

これ以外にもっと良い方法もありそうだけれど今のところ思いつかない
ので、より良い方法があったら、どこかにナレッジを記録してほしい

@nafell
メンション失礼。
「ダイアログを一度閉じた後に再度表示しない」で、他に良い方法あったりするかな。
今のところ案としては localStoragecookie が出てる。

@Shvain Shvain marked this pull request as ready for review June 10, 2024 13:39
Shvain added 3 commits June 10, 2024 23:36
一回ポップアップを消すと再度リンクに飛ぶ手段がないため、簡易的に追加。
@Shvain
Copy link
Member Author

Shvain commented Jun 10, 2024

ポップアップ閉じたあとのリンクに飛ぶ手段がないため、簡易的に追加。
アスペクト比によっては表示されないと思うけど
image

Copy link
Contributor

@wiyco wiyco left a comment

Choose a reason for hiding this comment

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

LGTM 🐳

piplup

@wiyco wiyco removed the Status: In Progress In Progress status label Jun 10, 2024
@Shvain Shvain merged commit f2d87a9 into develop Jun 11, 2024
2 checks passed
@Shvain Shvain deleted the new/surveypopupshown branch June 11, 2024 01:21
wiyco added a commit that referenced this pull request Jun 11, 2024
# Release
ホームページにアンケート誘導ポップアップの追加
おすすめ検索ボタンの下にアンケートリンクバナーの追加

## Related PRs

- #283 

## Remark
ポップアップ表示はlocalstorageを用いてポップアップ表示の切り替え

## Before submitting

> [!WARNING]
>
> The following is allowed for review only. (No additions or
modifications are permitted.)

- [x] I have read the [Contribution
Guidelines](https://github.com/iputapp/lounas/blob/develop/.github/CONTRIBUTING.md).
- [x] I agree to the [Code of
Conduct](https://github.com/iputapp/lounas/blob/develop/.github/CODE_OF_CONDUCT.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: New New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants