-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
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
src/components/AsideLayout.vueOops! Something went wrong! :( ESLint: 8.55.0 Error: ESLint configuration in .eslintrc.cjs is invalid:
WalkthroughAs 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 Changes
Sequence DiagramsequenceDiagram
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
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for soujunior-stars ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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çãoO 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
: Desativandoexplicit-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
OhandleChange
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 eventoA 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 CSSO 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 eventosA 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 visuaisO componente precisa de melhorias nos estilos:
- Faltam estados de hover e focus
- Não há estilo para estado desabilitado
- 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 utilizadasO
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-áreasA 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árioO 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
📒 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 doAsideLayout
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 doAsideLayout
A importação está correta. Confirme se o caminho para o arquivoAsideLayout.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 deecmaVersion
A opçãoecmaVersion: '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 semodelValue
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 atributoname="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.
There was a problem hiding this 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 tiposRecomendo 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 objetosPara 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 componenteAdicione
role
earia-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-áreasA 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
📒 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 pesquisaO 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>
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: '' | ||
}, | ||
}) |
There was a problem hiding this comment.
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.
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: () => '' | |
}, | |
}) |
There was a problem hiding this 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
📒 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 pesquisaO 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 issueCorrija 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.
const selectedArea = ref('') | ||
const selectedRole = ref('') | ||
const selectedSubArea = ref('') | ||
const selectedAvailability = ref('') | ||
const selectedPeriod = ref('') | ||
|
There was a problem hiding this comment.
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.
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 = '' | |
}) |
Summary by CodeRabbit
Notas de Lançamento
Novas Funcionalidades
AsideLayout
para seleção de perfil de usuário.CheckboxList
para seleção de áreas e funções.Configurações
Melhorias de Segurança
Alterações de Interface