Skip to content

fix(panel-app): DatePicker não-nativo para data de nascimento - #457

Merged
danielhe4rt merged 8 commits into
he4rt:4.xfrom
BrunaDomingues:fix/397-birthdate-datepicker
Aug 10, 2026
Merged

fix(panel-app): DatePicker não-nativo para data de nascimento#457
danielhe4rt merged 8 commits into
he4rt:4.xfrom
BrunaDomingues:fix/397-birthdate-datepicker

Conversation

@BrunaDomingues

@BrunaDomingues BrunaDomingues commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Substitui o <input type="date"> nativo do perfil por um DatePicker do Filament (native(false)), na seção Pessoal, junto com o nickname.
  • Destaca o dia atual no calendário para melhorar o contraste, especialmente no dark mode.
  • Adiciona ícone de calendário no campo e abre o picker ao clicar nele.

Fixes #397

Test plan

  • Abrir /app/profile e confirmar que "Data de Nascimento" usa o DatePicker do Filament (não o nativo do browser)
  • Abrir o calendário e confirmar que dias de meses adjacentes não aparecem como números ambíguos
  • No dark mode, confirmar que o dia de hoje fica visualmente distinto
  • Clicar no ícone de calendário e confirmar que o painel abre
  • Salvar uma data de nascimento e confirmar que persiste após reload

Mergir o PR #401 antes e resolver conflitos!!!!

BrunaDomingues and others added 4 commits July 26, 2026 20:51
Replace the native date input with a non-native Filament DatePicker in a personal section so adjacent-month days are no longer ambiguous.

Fixes he4rt#397

Co-authored-by: Cursor <cursoragent@cursor.com>
Make the current day easier to spot in dark mode with primary text and a ring.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add a calendar icon to the birthdate field and open the picker when the icon is clicked.

Co-authored-by: Cursor <cursoragent@cursor.com>
Leave the nickname input in the media header so this change stays compatible with the nickname validation flow in he4rt#401. Only birthdate moves to the DatePicker.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BrunaDomingues BrunaDomingues self-assigned this Jul 27, 2026
@BrunaDomingues
BrunaDomingues requested a review from a team July 27, 2026 00:06
Keep the nickname markup aligned with 4.x and cover birthdate in a dedicated test so merges with he4rt#401 stay cleaner.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e8747edb-a886-4084-9064-15208a76c54f

📥 Commits

Reviewing files that changed from the base of the PR and between 6305f39 and a392486.

📒 Files selected for processing (3)
  • app-modules/panel-app/resources/views/pages/profile.blade.php
  • app-modules/panel-app/src/Pages/ProfilePage.php
  • app-modules/panel-app/tests/Feature/ProfilePageTest.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • app-modules/panel-app/resources/views/pages/profile.blade.php
  • app-modules/panel-app/tests/Feature/ProfilePageTest.php
  • app-modules/panel-app/src/Pages/ProfilePage.php

📝 Walkthrough

Walkthrough

The profile page now uses a separate Filament DatePicker for birthdate state, initialization, validation bounds, and persistence. The media header receives and renders this form. CSS updates the calendar styling. A feature test verifies submission and persistence.

Possibly related PRs

Suggested reviewers: danielhe4rt

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: replacing the native birthdate field with a non-native Filament DatePicker.
Description check ✅ Passed The description explains the change, lists validation steps, and links issue #397; missing evidence is non-critical.
Linked Issues check ✅ Passed The implementation replaces the native picker, adds visual calendar behavior, limits dates to today, supports navigation, and preserves birthdate persistence for #397.
Out of Scope Changes check ✅ Passed The changed files support the linked issue objectives, including picker styling, icon interaction, state handling, persistence, and tests.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app-modules/panel-app/src/Pages/ProfilePage.php`:
- Around line 103-110: Update the ProfilePage save flow to use the dehydrated
$formData['birthdate'] value when constructing the DTO, rather than
$this->data['birthdate']. Preserve the DatePicker format('Y-m-d') output and
leave the component configuration unchanged.
- Around line 108-109: Update the DatePicker minDate and maxDate calls in the
profile date field to use date-only bounds via today()->subYears(120) and
today(), replacing the current now()-based values. Leave the surrounding picker
configuration unchanged.
- Around line 110-117: Update the suffix-icon interaction in the ProfilePage
date picker so keyboard users can activate the calendar affordance. Make the
suffix action focusable and provide an accessible name, or handle relevant
keyboard events to invoke the existing date-picker trigger, while preserving the
current click behavior and action-wrapper guard.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 53f1a5b4-b570-4a90-9872-a78e18a10606

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8d0bf and 3288f3e.

📒 Files selected for processing (4)
  • app-modules/panel-app/resources/views/components/profile-media-header.blade.php
  • app-modules/panel-app/src/Pages/ProfilePage.php
  • app-modules/panel-app/tests/Feature/ProfilePageTest.php
  • resources/css/filament/app/theme.css

Comment thread app-modules/panel-app/src/Pages/ProfilePage.php Outdated
Comment thread app-modules/panel-app/src/Pages/ProfilePage.php Outdated
Comment thread app-modules/panel-app/src/Pages/ProfilePage.php Outdated
Render the Filament birthdate picker in the media header next to nickname via a dedicated schema, preserving the original layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sirelves

sirelves commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Bruna, o CI tá vermelho aqui e acho que passou batido. O shard 1/2 quebra em profile page loads existing profile data, com headline vindo null.

Rodei local pra entender e o motivo é que os dois schemas dividem o mesmo state path:

$this->form->fill([... 'headline' => ..., 'seniority_level' => ..., ...]);  // $data = tudo
$this->birthdateForm->fill(['birthdate' => ...]);                           // $data = só birthdate

O fill() do Filament não faz merge, ele sobrescreve o state path inteiro. Dá pra ver em vendor/filament/schemas/src/Concerns/HasState.php:49, onde o rawState() faz data_set($livewire, $statePath, $state). Como o form e o birthdateForm apontam os dois pra data, o segundo fill() do mount() apaga tudo que o primeiro colocou. Na prática o usuário abre o /app/profile com os campos vazios mesmo tendo perfil preenchido.

Testei aqui dando um state path próprio pro birthdateForm e passa tudo, 17/17 incluindo o teu teste novo:

// propriedade nova na página
public ?array $birthdateData = [];

// birthdateForm()
->statePath('birthdateData');

// save()
$birthdateData = $this->birthdateForm->getState();
// ...
'birthdate' => $birthdateData['birthdate'] ?? null,

Outra coisa, bem menor: o x-on:click inline depende de classe interna do Filament (button.fi-fo-date-time-picker-trigger e .fi-input-wrp-suffix). Se um patch do Filament renomear isso, o clique no ícone para de funcionar e nenhum teste acusa. O CSS do "hoje" também toca classe interna, mas aí tudo bem, se mudar você só perde o destaque visual e nada quebra. Vale pesar se abrir o picker pelo ícone compensa esse acoplamento, já que clicar no campo em si também abre.

Filament fill() replaces the whole state path, so sharing data wiped headline and other fields on mount.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app-modules/panel-app/src/Pages/ProfilePage.php (1)

106-112: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add a clickable suffix action for the date picker.

The current DatePicker field only sets display/format/bounds and does not define suffixIcon() or suffixAction(). Add an accessible suffix action that calls togglePanelVisibility() so users can open the picker by clicking the calendar icon.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app-modules/panel-app/src/Pages/ProfilePage.php` around lines 106 - 112,
Update the DatePicker::make('birthdate') configuration to include a clickable,
accessible suffix action using the calendar icon that invokes
togglePanelVisibility(). Preserve the existing label, formatting, native mode,
and date bounds.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@app-modules/panel-app/src/Pages/ProfilePage.php`:
- Around line 106-112: Update the DatePicker::make('birthdate') configuration to
include a clickable, accessible suffix action using the calendar icon that
invokes togglePanelVisibility(). Preserve the existing label, formatting, native
mode, and date bounds.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 89188d75-5423-4be3-b914-61822c0762a1

📥 Commits

Reviewing files that changed from the base of the PR and between 69b1e81 and 6305f39.

📒 Files selected for processing (1)
  • app-modules/panel-app/src/Pages/ProfilePage.php

@danielhe4rt
danielhe4rt merged commit 6350329 into he4rt:4.x Aug 10, 2026
9 checks passed

@buzinei-bibi buzinei-bibi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calendário do campo "Data de Nascimento" mistura dias de meses adjacentes sem indicar a qual mês cada um pertence

5 participants