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

Cria filtros para Pesquisa #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BarbasPedro
Copy link

@BarbasPedro BarbasPedro commented Jan 26, 2025

Summary by CodeRabbit

Notas de Lançamento

  • Novas Funcionalidades

    • Adicionado novo componente AsideLayout para seleção de perfil de usuário.
    • Introduzido novo componente CheckboxList para seleção de áreas e funções.
  • Configurações

    • Configuração atualizada do ESLint para suporte a TypeScript.
    • Adicionadas novas opções de configuração para funções, áreas e disponibilidades.
  • Melhorias de Segurança

    • Implementado guard de navegação para rotas autenticadas, verificando token de autenticação.
  • Alterações de Interface

    • Simplificação do layout principal da aplicação, substituindo a estrutura anterior.
    • Remoção de elementos de navegação anteriores e lógica de autenticação.

Copy link

coderabbitai bot commented Jan 26, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/components/AsideLayout.vue

Oops! Something went wrong! :(

ESLint: 8.55.0

Error: ESLint configuration in .eslintrc.cjs is invalid:

  • Property "plugins" is the wrong type (expected array but got {"@typescript-eslint":true}).

    at ConfigValidator.validateConfigSchema (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2177:19)
    at ConfigArrayFactory._normalizeConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:19)
    at ConfigArrayFactory.loadInDirectory (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2887:33)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3890:20)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3890:20)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3792:18)
    at FileEnumerator._iterateFilesWithFile (/node_modules/eslint/lib/cli-engine/file-enumerator.js:368:43)
    at FileEnumerator._iterateFiles (/node_modules/eslint/lib/cli-engine/file-enumerator.js:349:25)
    at FileEnumerator.iterateFiles (/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:59)

Walkthrough

As mudanças introduzem suporte ao TypeScript e uma nova estrutura de componentes para o aplicativo. O projeto foi refatorado para utilizar uma abordagem mais modular, com a introdução de novos componentes como AsideLayout e CheckboxList. A configuração do ESLint foi atualizada para acomodar regras de TypeScript, e um novo sistema de navegação com guardas de autenticação foi implementado no roteador.

Changes

Arquivo Resumo das Alterações
.eslintrc.cjs Adicionado suporte ao TypeScript, novo plugin @typescript-eslint e configurações de regras
src/App.vue Substituído layout anterior por <AsideLayout />, removidas importações e lógicas antigas
src/assets/main.scss Comentadas importações de fontes e configurações do Vuetify
src/components/AsideLayout.vue Novo componente com seleção de funções e áreas usando Composition API
src/components/CheckboxList.vue Novo componente de lista de checkbox com suporte a TypeScript
src/router/index.js Adicionada guarda de navegação para verificação de autenticação
src/config/options.ts Adicionadas constantes para funções, áreas, disponibilidades e períodos

Sequence Diagram

sequenceDiagram
    participant User
    participant Router
    participant AuthGuard
    participant AsideLayout
    
    User->>Router: Navega na aplicação
    Router->>AuthGuard: Verifica autenticação
    alt Token válido
        AuthGuard-->>Router: Permite navegação
        Router->>AsideLayout: Carrega componente
        AsideLayout->>User: Exibe seleção de função e área
    else Sem token
        AuthGuard-->>Router: Redireciona para login
    end
Loading

Poem

🐰 Coelhinho saltitante, código em transformação
Typescript chega com sua nova versão
Componentes dançam, rotas se reorganizam
Autenticação segura, tudo se harmoniza
Um salto de inovação! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Jan 26, 2025

Deploy Preview for soujunior-stars ready!

Name Link
🔨 Latest commit b0a0d73
🔍 Latest deploy log https://app.netlify.com/sites/soujunior-stars/deploys/6796baddcbfbf80008555e49
😎 Deploy Preview https://deploy-preview-3--soujunior-stars.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 15

🔭 Outside diff range comments (1)
src/router/index.js (1)

Line range hint 146-161: Melhore o tratamento de autenticação no guard de navegação

O guard atual pode causar loops de redirecionamento e não trata erros adequadamente.

 router.beforeEach((to, from, next) => {
     const token = localStorage.getItem('token')
     const auth = useAuthStore();
 
-    if (to.meta.auth === true && (token === '' || token === null)) {
-        router.push({ name: 'login' })
+    // Evita loop de redirecionamento
+    if (to.name === 'login') {
+        return next()
+    }
+
+    if (to.meta.auth === true && (!token || token === '')) {
+        return next({ name: 'login' })
     } 
 
-    if (auth.auth.name === '') {
-        auth.loginByToken()
+    // Tenta autenticar apenas se houver token
+    if (token && auth.auth.name === '') {
+        try {
+            await auth.loginByToken()
+        } catch (error) {
+            console.error('Erro ao autenticar:', error)
+            return next({ name: 'login' })
+        }
     }
 
     return next()
 });
🧹 Nitpick comments (11)
src/App.vue (1)

10-10: Sem estilos definidos
O bloco de estilo está vazio. Caso deseje estilizar a aplicação globalmente, revise a organização de estilos para manter consistência e escalabilidade.

.eslintrc.cjs (1)

29-30: Desativando explicit-function-return-type
Desligar essa regra torna o código mais flexível, mas pode reduzir a clareza do tipo retornado. Avalie se é a melhor prática para este projeto ou se valeria a pena mantê-la ativa em partes críticas do código.

src/components/CheckboxList.vue (2)

25-31: Emissão de evento ao alterar checkbox
O handleChange emite apenas uma string ou vazio. Se pretender manipular várias seleções simultâneas, será preciso adaptar a lógica para emitir múltiplos valores. Caso seja uma escolha única, a abordagem atual é válida.


51-63: Estilos mínimos
A estilização é concisa e clara. Avalie se há necessidades futuras de responsividade ou acessibilidade que exijam mais regras de estilo.

src/components/CheckboxList.vue~ (4)

26-29: Adicione tipagem mais específica para o evento

A tipagem do evento pode ser mais específica para melhor segurança em tempo de compilação.

-  const handleChange = (event: Event) => {
+  const handleChange = (event: Event & { target: HTMLInputElement }) => {
-    const target = event.target as HTMLInputElement
+    const { target } = event
     emit('update:modelValue', target.value)
   }

51-63: Padronizar espaçamentos no CSS

O CSS está funcional, mas poderia ter mais consistência nos espaçamentos.

Sugiro estas melhorias:

 .checkboxList {
-    margin-top: 40px;
+    margin-top: 2.5rem;
 
     p {
-        margin-bottom: 8px;
+        margin-bottom: 0.5rem;
     }
 
     label {
-        margin-left: 4px;
+        margin-left: 0.25rem;
     }
 }

26-29: Melhorar a segurança da manipulação de eventos

A asserção de tipo do evento pode ser insegura. É recomendável adicionar uma verificação de tipo mais robusta.

Considere esta implementação mais segura:

 const handleChange = (event: Event) => {
-  const target = event.target as HTMLInputElement
+  if (!(event.target instanceof HTMLInputElement)) return
+  const target = event.target
   emit('update:modelValue', target.value)
 }

51-63: Melhorar estilos e estados visuais

O componente precisa de melhorias nos estilos:

  1. Faltam estados de hover e focus
  2. Não há estilo para estado desabilitado
  3. Não há considerações responsivas

Considere adicionar estes estilos:

 <style scoped>
   .checkboxList {
     margin-top: 40px;
+    @media (max-width: 768px) {
+      margin-top: 20px;
+    }
 
     p {
       margin-bottom: 8px;
+      font-weight: 500;
     }
 
+    input {
+      &:hover {
+        cursor: pointer;
+      }
+
+      &:focus {
+        outline: 2px solid #0066cc;
+        outline-offset: 2px;
+      }
+
+      &:disabled {
+        cursor: not-allowed;
+        opacity: 0.5;
+      }
+    }
+
     label {
       margin-left: 4px;
+      
+      &:hover {
+        cursor: pointer;
+      }
     }
   }
 </style>
src/components/AsideLayout.vue (2)

2-2: Remova importações não utilizadas

O watch está sendo importado mas não está sendo utilizado no componente.

-import { ref, watch } from 'vue'
+import { ref } from 'vue'

82-96: Simplifique a lógica condicional de sub-áreas

A renderização condicional das sub-áreas pode ser simplificada usando um objeto de mapeamento.

const areaToSubAreas = {
  'Produto': productManagerSubAreas,
  'Design': designSubAreas,
  'Dados': dataSubAreas,
  'Business': businessSubAreas
} as const

// No template:
<CheckboxList
  v-if="selectedRole !== 'Head' && selectedArea && areaToSubAreas[selectedArea]"
  :label="'SUB-ÁREA'"
  :values="areaToSubAreas[selectedArea]"
/>
src/components/Aside.vue~ (1)

59-61: Adicionar estilos essenciais para o layout do formulário

O bloco de estilos está vazio, mas é necessário para um layout adequado.

Sugiro adicionar estes estilos básicos:

 <style scoped>
+.filter-aside {
+  padding: 1.5rem;
+  background: #f5f5f5;
+  border-radius: 0.5rem;
+}
+
+.filter-submit {
+  margin-top: 2rem;
+  width: 100%;
+  padding: 0.75rem;
+  background: #007bff;
+  color: white;
+  border: none;
+  border-radius: 0.25rem;
+  cursor: pointer;
+}
+
+.filter-submit:hover {
+  background: #0056b3;
+}
 </style>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed34fd7 and a47b618.

📒 Files selected for processing (8)
  • .eslintrc.cjs (2 hunks)
  • src/App.vue (1 hunks)
  • src/assets/main.scss (1 hunks)
  • src/components/Aside.vue~ (1 hunks)
  • src/components/AsideLayout.vue (1 hunks)
  • src/components/CheckboxList.vue (1 hunks)
  • src/components/CheckboxList.vue~ (1 hunks)
  • src/router/index.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/assets/main.scss
👮 Files not reviewed due to content moderation or server errors (2)
  • src/components/CheckboxList.vue~
  • src/components/Aside.vue~
🔇 Additional comments (8)
src/App.vue (2)

2-2: Uso do AsideLayout substitui layout anterior
A adoção direta de <AsideLayout /> elimina o layout e a lógica de navegação anterior. Verifique se as rotas e estados que existiam antes estão devidamente realocados dentro do novo componente ou em outro lugar adequado.


6-6: Importação do AsideLayout
A importação está correta. Confirme se o caminho para o arquivo AsideLayout.vue corresponde à estrutura do projeto.

.eslintrc.cjs (3)

2-2: Adição de comentário para suporte ao TypeScript
A inclusão de /* @typescript-eslint */ é útil para identificar o uso de TypeScript, mas confirme se isso reflete corretamente o restante da configuração.


25-25: Configuração de ecmaVersion
A opção ecmaVersion: 'latest' permite recursos recentes do JavaScript. Atenção para possíveis incompatibilidades se o projeto for executado em ambientes mais antigos.


26-28: Plugins adicionados
A propriedade "plugins": { "@typescript-eslint": true } ativa as regras do TypeScript ESLint. Verifique se não conflita com as regras já existentes do Vue ou ESLint padrão.

src/components/CheckboxList.vue (2)

1-23: Definição de props
As props estão bem definidas, mas verifique se modelValue como string atende casos de múltipla seleção. Se for necessário manejar múltiplos valores selecionados, considere mudar para um tipo de array ou outra estrutura.


33-49: Renderização dos inputs
A renderização dinâmica dos valores funciona, mas confirme se o atributo name="value" é o ideal ou se cada checkbox deve ter um nome diferenciado. Isso ajuda na acessibilidade e em testes.

src/router/index.js (1)

143-144: LGTM!

A adição das chaves faltantes melhora a legibilidade do código.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
src/config/options.ts (2)

1-14: Adicione tipos enumerados para melhor segurança de tipos

Recomendo definir tipos enumerados para roles, periods e outras constantes para garantir segurança de tipos e facilitar a manutenção.

+export enum Role {
+  Head = 'Head',
+  Mentor = 'Mentor',
+  Junior = 'Junior'
+}

+export enum Period {
+  Morning = 'Manhã',
+  Afternoon = 'Tarde',
+  Night = 'Noite'
+}

-export const roles = ['Head', 'Mentor', 'Junior']
+export const roles = Object.values(Role)

-export const periods = ['Manhã', 'Tarde', 'Noite']
+export const periods = Object.values(Period)

4-5: Considere agrupar áreas relacionadas em objetos

Para melhor organização e manutenção, considere agrupar as áreas em um objeto.

+export const areas = {
+  head: ['Agilidade', 'Back-End', 'Business', 'Dados', 'Design', 'DevOps', 'Front-End', 'Produto', 'QA - Quality Assurance', 'Tech Recruitment'],
+  junior: ['Agilidade', 'Back-End', 'Business', 'Dados', 'Design', 'DevOps', 'Front-End', 'Produto', 'QA - Quality Assurance', 'Social Media', 'Tech Recruitment']
+} as const

-export const headAreas = ['Agilidade', 'Back-End', ...]
-export const juniorAreas = ['Agilidade', 'Back-End', ...]
src/components/CheckboxList.vue (1)

37-49: Melhore a acessibilidade e semântica do componente

Adicione role e aria-checked para melhor suporte a leitores de tela.

 <div v-for="value in values" :key="value">
   <input
     :id="`input-${value}`"
     :key="value"
     :value="value"
     :type="inputType"
     :checked="modelValue === value"
     :aria-label="value"
+    :role="inputType"
+    :aria-checked="modelValue === value"
     name="value"
     @change="handleChange"
   />
   <label :for="`input-${value}`">{{ value }}</label>
 </div>
src/components/AsideLayout.vue (1)

41-55: Refatore a renderização condicional de sub-áreas

A lógica de renderização das sub-áreas pode ser simplificada usando um objeto de mapeamento.

+const areaToSubAreas = {
+  'Produto': productManagerSubAreas,
+  'Design': designSubAreas,
+  'Dados': dataSubAreas,
+  'Business': businessSubAreas
+} as const

-<div v-if="selectedRole !== 'Head' && selectedArea">
-  <CheckboxList
-    v-if="selectedArea === 'Produto'"
-    :label="'SUB-ÁREA'"
-    :values="productManagerSubAreas"
-  />
-  <CheckboxList v-if="selectedArea === 'Design'" ... />
-  <CheckboxList v-if="selectedArea === 'Dados'" ... />
-  <CheckboxList v-if="selectedArea === 'Business'" ... />
-</div>

+<CheckboxList
+  v-if="selectedRole !== 'Head' && selectedArea && areaToSubAreas[selectedArea]"
+  :label="'SUB-ÁREA'"
+  :values="areaToSubAreas[selectedArea]"
+  v-model="selectedSubArea"
+/>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a47b618 and 730697f.

📒 Files selected for processing (3)
  • src/components/AsideLayout.vue (1 hunks)
  • src/components/CheckboxList.vue (1 hunks)
  • src/config/options.ts (1 hunks)
🔇 Additional comments (1)
src/components/AsideLayout.vue (1)

21-60: Implemente o handler do botão de pesquisa

O componente ainda precisa de um botão e handler para processar a pesquisa.

 <aside>
   <!-- ... outros componentes ... -->
+  <button 
+    type="button" 
+    class="search-button"
+    @click="handleSearch"
+  >
+    Pesquisar
+  </button>
 </aside>

+<script setup lang="ts">
+// ... código existente ...
+
+const handleSearch = () => {
+  const searchParams = {
+    role: selectedRole.value,
+    area: selectedArea.value,
+    subArea: selectedSubArea.value,
+    availability: selectedAvailability.value,
+    period: selectedPeriod.value
+  }
+  
+  // Emitir evento com parâmetros de pesquisa
+  emit('search', searchParams)
+}
+</script>

Comment on lines +4 to +24
defineProps({
values: {
type: Array as PropType<string[]>,
required: true
},
label: {
type: String,
required: false,
default: ''
},
inputType: {
type: String,
required: false,
default: 'checkbox'
},
modelValue: {
type: String as PropType<string>,
required: false,
default: ''
},
})
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Implemente suporte completo ao v-model

O componente precisa suportar arrays para checkboxes múltiplos.

 defineProps({
   values: {
     type: Array as PropType<string[]>,
     required: true
   },
   modelValue: {
-    type: String as PropType<string>,
+    type: [String, Array] as PropType<string | string[]>,
     required: false,
-    default: ''
+    default: () => ''
   },
   // ... outros props
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
defineProps({
values: {
type: Array as PropType<string[]>,
required: true
},
label: {
type: String,
required: false,
default: ''
},
inputType: {
type: String,
required: false,
default: 'checkbox'
},
modelValue: {
type: String as PropType<string>,
required: false,
default: ''
},
})
defineProps({
values: {
type: Array as PropType<string[]>,
required: true
},
label: {
type: String,
required: false,
default: ''
},
inputType: {
type: String,
required: false,
default: 'checkbox'
},
modelValue: {
type: [String, Array] as PropType<string | string[]>,
required: false,
default: () => ''
},
})

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 730697f and b0a0d73.

📒 Files selected for processing (1)
  • src/components/AsideLayout.vue (1 hunks)
🔇 Additional comments (3)
src/components/AsideLayout.vue (3)

1-4: Boa estruturação do componente!

A configuração do TypeScript e as importações estão bem organizadas.


13-19: Implemente o handler do botão de pesquisa

O componente ainda necessita de um handler para processar a submissão dos filtros selecionados.

 const handleAreaSelection = (area: string) => {
   if (selectedArea.value === area) {
     selectedArea.value = ''
   } else {
     selectedArea.value = area
   }
 }
+
+const handleSearch = () => {
+  const filters = {
+    role: selectedRole.value,
+    area: selectedArea.value,
+    subArea: selectedSubArea.value,
+    availability: selectedAvailability.value,
+    period: selectedPeriod.value
+  }
+  
+  // Emitir evento com os filtros selecionados
+  emit('search', filters)
+}

42-60: ⚠️ Potential issue

Corrija os bindings dos componentes CheckboxList

Os componentes de sub-área, disponibilidade e período estão sem o v-model necessário para capturar as seleções.

       <CheckboxList
         v-if="selectedArea === 'Produto'"
         :label="'SUB-ÁREA'"
         :values="productManagerSubAreas"
+        v-model="selectedSubArea"
       />
-      <CheckboxList v-if="selectedArea === 'Design'" :label="'SUB-ÁREA'" :values="designSubAreas" />
+      <CheckboxList v-if="selectedArea === 'Design'" :label="'SUB-ÁREA'" :values="designSubAreas" v-model="selectedSubArea" />
-      <CheckboxList v-if="selectedArea === 'Dados'" :label="'SUB-ÁREA'" :values="dataSubAreas" />
+      <CheckboxList v-if="selectedArea === 'Dados'" :label="'SUB-ÁREA'" :values="dataSubAreas" v-model="selectedSubArea" />
       <CheckboxList
         v-if="selectedArea === 'Business'"
         :label="'SUB-ÁREA'"
         :values="businessSubAreas"
+        v-model="selectedSubArea"
       />
 
-    <CheckboxList :label="'DISPONIBILIDADE'" :values="availabilities" />
-    <CheckboxList :label="'PERÍODO DE DISPONIBILIDADE'" :values="periods"/>
+    <CheckboxList :label="'DISPONIBILIDADE'" :values="availabilities" v-model="selectedAvailability" />
+    <CheckboxList :label="'PERÍODO DE DISPONIBILIDADE'" :values="periods" v-model="selectedPeriod" />
+    
+    <button type="button" class="search-button" @click="handleSearch">
+      Pesquisar
+    </button>

Likely invalid or redundant comment.

Comment on lines +6 to +11
const selectedArea = ref('')
const selectedRole = ref('')
const selectedSubArea = ref('')
const selectedAvailability = ref('')
const selectedPeriod = ref('')

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Adicione efeitos de observação para gerenciar estados dependentes

É necessário resetar estados dependentes quando as seleções principais são alteradas.

 const selectedArea = ref('')
 const selectedRole = ref('')
 const selectedSubArea = ref('')
 const selectedAvailability = ref('')
 const selectedPeriod = ref('')
+
+// Reseta a área selecionada quando o cargo muda
+watch(selectedRole, () => {
+  selectedArea.value = ''
+  selectedSubArea.value = ''
+})
+
+// Reseta a sub-área quando a área muda
+watch(selectedArea, () => {
+  selectedSubArea.value = ''
+})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const selectedArea = ref('')
const selectedRole = ref('')
const selectedSubArea = ref('')
const selectedAvailability = ref('')
const selectedPeriod = ref('')
const selectedArea = ref('')
const selectedRole = ref('')
const selectedSubArea = ref('')
const selectedAvailability = ref('')
const selectedPeriod = ref('')
// Reseta a área selecionada quando o cargo muda
watch(selectedRole, () => {
selectedArea.value = ''
selectedSubArea.value = ''
})
// Reseta a sub-área quando a área muda
watch(selectedArea, () => {
selectedSubArea.value = ''
})

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.

2 participants