Skip to content

feat/239-haptics#241

Closed
olios123 wants to merge 10 commits intodevfrom
feat/239-haptics
Closed

feat/239-haptics#241
olios123 wants to merge 10 commits intodevfrom
feat/239-haptics

Conversation

@olios123
Copy link
Copy Markdown
Member

@olios123 olios123 commented Apr 20, 2026

Dodałem hapticsy

Important

iOS i ogólnie wiele przeglądarek ma problemy z tymi hapticsami i może nie działać

Zostały dodane do:

  • Wszystkie switche (są tylko w ustawieniach)
  • Przyciski +/- w ustawieniach
  • Importowanie quizu error i success
  • Zaznaczanie pytania w quizie
  • Przejście do kolejnego i poprzedniego pytania
  • Odpowiedzenie poprawnie/błędnie na pytanie

Ustawienie zapisuje się tylko lokalnie w localStorage per urządzenie.
image
Oddzieliłem hapticsy od reszty ustawień aby się nie mieszały.

Nie miałem pomysłu na więcej hapticsów aby też nie nawalić tego bez sensu.

CLOSES #239

olios123 and others added 8 commits April 2, 2026 23:36
* feat: 134-max-question-reoccurrences (#232)

* feat: add max question reoccurrences slider

* feat: add max question reoccurrences slider

* feat: max question reoccurrences logic

* refactor: use utils function

* refactor: slider change

* feat: add slider descriptions

* refactor: edit session answers count logic

* refactor: upgrade save slider values

* refactor: upgrade settings logic

* refactor: upgrade settings slider logic

* refactor: change default settings

* feat: new settings form

* refactor: responsive

* fix: bug fixes

* refactor: settings change

* refactor: buttons change

* feat: add account level badge for gold users and update profile display

* feat: new brainrot options

* refactor: copilot suggestions

* refactor: change Minecraft parkour video

---------

Co-authored-by: Antoni Czaplicki <antekczaplicki@gmail.com>
* refactor: base ui and settings improvements

# Conflicts:
#	src/components/navbar/auth-buttons.tsx
#	src/components/profile/settings-form.tsx
#	src/components/quiz/brainrot-card.tsx

* refactor: dev

* chore: add icons library

* refactor: change icon library

* chore: remove icons package

* feat: nested dialogs

* refactor: lock

* refactor: lint
Copilot AI review requested due to automatic review settings April 20, 2026 17:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Dodanie obsługi haptics (wibracji) w aplikacji poprzez nowy hook oraz podpięcie go do wybranych interakcji UI (przyciski, switche, quiz, import).

Changes:

  • Dodano zależność web-haptics oraz hook useHaptics do wyzwalania presetów wibracji.
  • Podpięto haptics do importu quizu, tworzenia quizu oraz kluczowych akcji w rozwiązywaniu quizu.
  • Rozszerzono komponent Button o opcjonalne haptics na klik oraz dodano wibracje do Switch i ustawień.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/lib/import-quiz.ts Haptics dla success/error przy imporcie quizu.
src/hooks/haptics.ts Nowy hook integrujący web-haptics + stan w localStorage.
src/components/ui/switch.tsx Dodanie wibracji przy interakcji z przełącznikiem.
src/components/ui/button.tsx Flaga hapticsOnClick do wibracji na klik.
src/components/quiz/question-card.tsx Haptics przy zaznaczaniu odpowiedzi oraz akcjach nawigacyjnych.
src/components/quiz/hooks/use-quiz-logic.ts Haptics success/error po sprawdzeniu odpowiedzi.
src/components/profile/settings-form.tsx UI do włączenia/wyłączenia haptics + haptics na przyciskach +/- .
src/app/create-quiz/client.tsx Haptics success/error przy zapisie quizu.
package.json Dodanie web-haptics.
package-lock.json Lockfile dla web-haptics.
Comments suppressed due to low confidence (1)

src/components/ui/switch.tsx:31

  • W Switch haptics są podpinane przez onClick, ale potem robisz {...props} po tym handlerze. Jeśli ktoś przekaże własny onClick w propsach, to nadpisze on ten z hapticsami i wibracja przestanie działać. Lepiej jawnie zmergować handlery (wywołać propsowe onClick + haptics) albo rozważyć użycie onCheckedChange zamiast onClick.
    <SwitchPrimitive.Root
      data-slot="switch"
      data-size={size}
      role="switch"
      onClick={async () => {
        await haptics.vibrate("selection");
      }}
      className={cn(
        "peer aria-checked:dark:bg-accent-input bg-accent-input dark:bg-input/80 inline-flex h-6 w-12 shrink-0 items-center rounded-[10px] border border-transparent shadow-xs transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50 aria-checked:bg-(--cta-gradient-from)",
        "focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-[3px]",
        className,
      )}
      {...props}
    >

Comment thread src/components/profile/settings-form.tsx Outdated
Comment thread src/components/profile/settings-form.tsx Outdated
Comment thread src/components/profile/settings-form.tsx
Comment thread src/components/profile/settings-form.tsx Outdated
Comment thread src/hooks/use-haptics.ts
Comment thread src/hooks/haptics.ts
Copilot AI review requested due to automatic review settings April 20, 2026 17:58
@olios123 olios123 requested a review from MarvinRucinski April 20, 2026 18:01
@Antoni-Czaplicki
Copy link
Copy Markdown
Member

Let’s put it on hold until we know if it’s going to be supported in iOS in the feature lochie/web-haptics#36

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/components/ui/switch.tsx:31

  • Because {...props} is spread after onClick, any consumer-provided onClick will override this handler and haptics won’t trigger. If you want Switch haptics to be reliable while still allowing consumers to handle clicks, destructure onClick from props and compose it (call the consumer handler first/last, then trigger haptics), and spread the remaining props.
        "focus-visible:border-ring focus-visible:ring-ring focus-visible:ring-[3px]",
        className,
      )}
      {...props}
    >

Comment thread src/hooks/use-haptics.ts
Comment thread src/components/profile/settings-form.tsx
@olios123 olios123 marked this pull request as draft April 21, 2026 08:29
@Antoni-Czaplicki
Copy link
Copy Markdown
Member

closing for now as looks like haptics were disabled for good on safari

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.

[FEATURE] Hapticsy

3 participants