-
-
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
Adicionar listagem de candidatos #2
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAs alterações envolvem uma reformulação significativa do Changes
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: 2
🧹 Nitpick comments (2)
src/App.vue (2)
19-28
: Adicionar validação de dados e melhorar a estrutura do componenteO componente atual pode ser melhorado com validação de dados e uso do Composition API.
Sugestão de refatoração:
-<script> +<script setup lang="ts"> import vacancies from "./components/data/vancacyMok.json"; +import { ref, onMounted } from 'vue'; + +interface Vacancy { + id: number; + position: string; + product: string; + applicationDate: string; + candidates: number; + priority: string; +} + +const vacancies = ref<Vacancy[]>([]); + +onMounted(async () => { + try { + // Simular chamada API com dados mockados + vacancies.value = await Promise.resolve(vacanciesMock); + } catch (error) { + console.error('Erro ao carregar vagas:', error); + } +}); -export default { - data() { - return { - vacancies, // Dados importados arquivo JSON - }; - }, -}; </script>
31-50
: Melhorar a responsividade e consistência visualO estilo atual precisa de ajustes para melhor responsividade e integração com um design system.
Sugestões de melhorias:
<style scoped> +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} + .vacancies-card { border: 1px solid #ccc; border-radius: 8px; padding: 16px; margin: 16px 0; background-color: #f9f9f9; color: rgb(0, 0, 0); + max-width: 800px; + margin: 16px auto; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .details-btn { background-color: #007bff; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; + transition: background-color 0.2s ease; } .details-btn:hover { background-color: #0056b3; } + +@media (max-width: 768px) { + .vacancies-card { + margin: 16px; + } +} </style>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/App.vue
(1 hunks)src/components/data/vancacyMok.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/components/data/vancacyMok.json
src/App.vue
Outdated
</v-app> | ||
<div> | ||
<div | ||
v-for="vacancies in vacancies" |
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.
Corrigir sintaxe do v-for para evitar confusão
A sintaxe atual do v-for usa o mesmo nome para o item e a coleção, o que pode causar confusão e bugs.
Aplique esta correção:
- v-for="vacancies in vacancies"
+ v-for="vacancy in vacancies"
📝 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.
v-for="vacancies in vacancies" | |
v-for="vacancy in vacancies" |
src/App.vue
Outdated
<div> | ||
<div | ||
v-for="vacancies in vacancies" | ||
:key="vacancies.id" | ||
class="vacancies-card" | ||
> | ||
<h3>Produto {{ vacancies.id }}</h3> | ||
<p><strong>Cargo:</strong> {{ vacancies.position }}</p> | ||
<p><strong>Produto:</strong> {{ vacancies.product }}</p> | ||
<p><strong>Data da candidatura:</strong> {{ vacancies.applicationDate }}</p> | ||
<p><strong>Candidatos:</strong> {{ vacancies.candidates }}</p> | ||
<p><strong>Prioridade da vaga:</strong> {{ vacancies.priority }}</p> | ||
<button class="details-btn">Detalhes da vaga</button> | ||
</div> | ||
</div> |
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
Melhorar a estrutura semântica e acessibilidade
O template atual precisa de melhorias na estrutura HTML e acessibilidade.
Sugestões de melhorias:
<template>
- <div>
+ <main>
+ <h1 class="sr-only">Lista de Vagas</h1>
+ <section v-if="vacancies.length" aria-label="Lista de vagas disponíveis">
<div
- v-for="vacancies in vacancies"
+ v-for="vacancy in vacancies"
:key="vacancies.id"
class="vacancies-card"
+ role="article"
>
- <h3>Produto {{ vacancies.id }}</h3>
+ <h2>Produto {{ vacancy.id }}</h2>
<!-- ... resto do conteúdo ... -->
- <button class="details-btn">Detalhes da vaga</button>
+ <button
+ class="details-btn"
+ :aria-label="'Ver detalhes da vaga para ' + vacancy.position"
+ >
+ Detalhes da vaga
+ </button>
</div>
- </div>
+ </section>
+ <p v-else class="empty-state">Nenhuma vaga disponível no momento.</p>
+ </main>
</template>
📝 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.
<div> | |
<div | |
v-for="vacancies in vacancies" | |
:key="vacancies.id" | |
class="vacancies-card" | |
> | |
<h3>Produto {{ vacancies.id }}</h3> | |
<p><strong>Cargo:</strong> {{ vacancies.position }}</p> | |
<p><strong>Produto:</strong> {{ vacancies.product }}</p> | |
<p><strong>Data da candidatura:</strong> {{ vacancies.applicationDate }}</p> | |
<p><strong>Candidatos:</strong> {{ vacancies.candidates }}</p> | |
<p><strong>Prioridade da vaga:</strong> {{ vacancies.priority }}</p> | |
<button class="details-btn">Detalhes da vaga</button> | |
</div> | |
</div> | |
<main> | |
<h1 class="sr-only">Lista de Vagas</h1> | |
<section v-if="vacancies.length" aria-label="Lista de vagas disponíveis"> | |
<div | |
v-for="vacancy in vacancies" | |
:key="vacancies.id" | |
class="vacancies-card" | |
role="article" | |
> | |
<h2>Produto {{ vacancy.id }}</h2> | |
<p><strong>Cargo:</strong> {{ vacancies.position }}</p> | |
<p><strong>Produto:</strong> {{ vacancies.product }}</p> | |
<p><strong>Data da candidatura:</strong> {{ vacancies.applicationDate }}</p> | |
<p><strong>Candidatos:</strong> {{ vacancies.candidates }}</p> | |
<p><strong>Prioridade da vaga:</strong> {{ vacancies.priority }}</p> | |
<button | |
class="details-btn" | |
:aria-label="'Ver detalhes da vaga para ' + vacancy.position" | |
> | |
Detalhes da vaga | |
</button> | |
</div> | |
</section> | |
<p v-else class="empty-state">Nenhuma vaga disponível no momento.</p> | |
</main> |
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
🧹 Nitpick comments (2)
src/App.vue (2)
21-30
: Sugestões de melhorias para o scriptAlgumas sugestões para melhorar a manutenibilidade do código:
- Considere adicionar tipos TypeScript para melhor segurança:
interface Vacancy { id: number; position: string; product: string; applicationDate: string; candidates: number; priority: string; } export default { data(): { vacancies: Vacancy[]; } { return { vacancies, }; }, };
- Remova o comentário redundante da linha 27, pois a origem dos dados já está clara pelo import.
32-52
: Melhorar a manutenibilidade dos estilosSugestões para melhorar a organização e experiência do usuário:
<style scoped> +:root { + --card-border-color: #ccc; + --card-bg-color: #f9f9f9; + --text-color: #000; + --button-primary: #007bff; + --button-primary-hover: #0056b3; +} + .vacancies-card { - border: 1px solid #ccc; + border: 1px solid var(--card-border-color); border-radius: 8px; padding: 16px; margin: 16px 0; - background-color: #f9f9f9; - color: rgb(0, 0, 0); + background-color: var(--card-bg-color); + color: var(--text-color); } .details-btn { - background-color: #007bff; + background-color: var(--button-primary); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; + transition: background-color 0.2s ease; } .details-btn:hover { - background-color: #0056b3; + background-color: var(--button-primary-hover); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/App.vue
(1 hunks)
🧰 Additional context used
🪛 ESLint
src/App.vue
[error] 5-5: Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive.
(vue/valid-v-for)
🔇 Additional comments (1)
src/App.vue (1)
2-18
: Boa implementação de acessibilidade e estrutura semântica!A estrutura do template está bem organizada com:
- Uso apropriado de tags semânticas (
main
,section
)- Rótulos ARIA
- Tratamento de estado vazio
- Texto alternativo para botões
🧰 Tools
🪛 ESLint
[error] 5-5: Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive.
(vue/valid-v-for)
src/App.vue
Outdated
<main> | ||
<h1 class="sr-only">Lista de Vagas</h1> | ||
<section v-if="vacancies.length" aria-label="Lista de vagas disponíveis"> | ||
<div v-for="vacancy in vacancies" :key="vacancies.id" class="vacancies-card"> |
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.
Corrigir o binding da propriedade key no v-for
Existe uma inconsistência no binding da propriedade key que pode causar problemas de renderização.
Aplique esta correção:
- <div v-for="vacancy in vacancies" :key="vacancies.id" class="vacancies-card">
+ <div v-for="vacancy in vacancies" :key="vacancy.id" class="vacancies-card">
📝 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.
<div v-for="vacancy in vacancies" :key="vacancies.id" class="vacancies-card"> | |
<div v-for="vacancy in vacancies" :key="vacancy.id" class="vacancies-card"> |
🧰 Tools
🪛 ESLint
[error] 5-5: Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive.
(vue/valid-v-for)
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 (2)
src/App.vue (2)
7-11
: Externalizar strings para facilitar internacionalizaçãoAs strings estão hardcoded no template, o que dificulta a manutenção e internacionalização.
Recomendo criar um arquivo de traduções e utilizar a biblioteca i18n:
- <p><strong>Cargo:</strong> {{ vacancy.position }}</p> - <p><strong>Produto:</strong> {{ vacancy.product }}</p> - <p><strong>Data da candidatura:</strong> {{ vacancy.applicationDate }}</p> - <p><strong>Candidatos:</strong> {{ vacancy.candidates }}</p> - <p><strong>Prioridade da vaga:</strong> {{ vacancy.priority }}</p> + <p><strong>{{ $t('vacancy.position') }}:</strong> {{ vacancy.position }}</p> + <p><strong>{{ $t('vacancy.product') }}:</strong> {{ vacancy.product }}</p> + <p><strong>{{ $t('vacancy.applicationDate') }}:</strong> {{ vacancy.applicationDate }}</p> + <p><strong>{{ $t('vacancy.candidates') }}:</strong> {{ vacancy.candidates }}</p> + <p><strong>{{ $t('vacancy.priority') }}:</strong> {{ vacancy.priority }}</p>
32-52
: Melhorar estilos com responsividade e temasOs estilos atuais não são responsivos e não utilizam variáveis de tema.
Sugiro as seguintes melhorias:
<style scoped> +@media (min-width: 768px) { + section { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + gap: 1rem; + } +} + +:root { + --primary-color: #007bff; + --primary-hover: #0056b3; + --card-bg: #f9f9f9; + --border-color: #ccc; +} + .vacancies-card { - border: 1px solid #ccc; + border: 1px solid var(--border-color); border-radius: 8px; padding: 16px; margin: 16px 0; - background-color: #f9f9f9; + background-color: var(--card-bg); color: rgb(0, 0, 0); + transition: transform 0.2s ease; } +.vacancies-card:hover { + transform: translateY(-2px); +} + .details-btn { - background-color: #007bff; + background-color: var(--primary-color); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; + transition: background-color 0.2s ease; } .details-btn:hover { - background-color: #0056b3; + background-color: var(--primary-hover); } + +.loading-state, +.error-state, +.empty-state { + text-align: center; + padding: 2rem; +} </style>
<script> | ||
import vacancies from "./components/data/vancacyMok.json"; | ||
|
||
console.log('logged', route.path) | ||
const ef = computed(() => (route.path === '/' ? 'homeBackgroundEffect' : '')) | ||
|
||
const navigateToHome = () => { | ||
router.push({ name: 'home' }) | ||
} | ||
|
||
function toggleTheme() { | ||
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark' | ||
localStorage.setItem('theme', theme.global.name.value) | ||
} | ||
export default { | ||
data() { | ||
return { | ||
vacancies, // Dados importados arquivo JSON | ||
}; | ||
}, | ||
}; |
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
Melhorar gerenciamento de estado e tipagem
O script atual não possui tratamento de erros, estado de carregamento ou tipagem.
Sugiro refatorar para Composition API com TypeScript:
-<script>
+<script setup lang="ts">
-import vacancies from "./components/data/vancacyMok.json";
+import { ref, onMounted } from 'vue'
+import type { Vacancy } from '@/types'
+import { getVacancies } from '@/services/vacancies'
-export default {
- data() {
- return {
- vacancies, // Dados importados arquivo JSON
- };
- },
-};
+interface Vacancy {
+ id: number
+ position: string
+ product: string
+ applicationDate: string
+ candidates: number
+ priority: string
+}
+const vacancies = ref<Vacancy[]>([])
+const isLoading = ref(true)
+const error = ref<string | null>(null)
+async function fetchVacancies() {
+ try {
+ isLoading.value = true
+ vacancies.value = await getVacancies()
+ } catch (e) {
+ error.value = e instanceof Error ? e.message : 'Erro desconhecido'
+ } finally {
+ isLoading.value = false
+ }
+}
+onMounted(() => {
+ fetchVacancies()
+})
Committable suggestion skipped: line range outside the PR's diff.
<section v-if="vacancies.length" aria-label="Lista de vagas disponíveis"> | ||
<div v-for="vacancy in vacancies" :key="vacancy.id" class="vacancies-card"> | ||
<h2>Produto {{ vacancy.id }}</h2> | ||
<p><strong>Cargo:</strong> {{ vacancy.position }}</p> | ||
<p><strong>Produto:</strong> {{ vacancy.product }}</p> | ||
<p><strong>Data da candidatura:</strong> {{ vacancy.applicationDate }}</p> | ||
<p><strong>Candidatos:</strong> {{ vacancy.candidates }}</p> | ||
<p><strong>Prioridade da vaga:</strong> {{ vacancy.priority }}</p> | ||
<button class="details-btn" :aria-label="'Ver detalhes da vaga para ' + vacancy.position"> | ||
Detalhes da vaga | ||
</button> | ||
</div> | ||
</v-app-bar> | ||
|
||
|
||
<transition name="fade" mode="out-in"> | ||
<v-main class="d-flex flex-grow-1 " style="margin-top: 64px"> | ||
<RouterView /> | ||
|
||
<v-snackbar v-model="snackbarStore.snack.show" v-bind="snackbarStore.snack" location="top right"> | ||
{{ text }} | ||
<template #actions> | ||
<v-btn variant="text" @click="snackbar = false"> | ||
Close | ||
</v-btn> | ||
</template> | ||
</v-snackbar> | ||
|
||
</v-main> | ||
</transition> | ||
|
||
|
||
</v-app> | ||
</section> | ||
<p v-else class="empty-state">Nenhuma vaga disponível no momento.</p> |
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
Adicionar estados de carregamento e erro
O componente precisa lidar com diferentes estados da aplicação para melhorar a experiência do usuário.
Aplique esta alteração:
<template>
<main>
<h1 class="sr-only">Lista de Vagas</h1>
- <section v-if="vacancies.length" aria-label="Lista de vagas disponíveis">
+ <div v-if="isLoading" class="loading-state">
+ <p>Carregando vagas...</p>
+ </div>
+ <div v-else-if="error" class="error-state">
+ <p>Erro ao carregar vagas: {{ error }}</p>
+ </div>
+ <section v-else-if="vacancies.length" aria-label="Lista de vagas disponíveis">
<!-- ... resto do conteúdo ... -->
</section>
<p v-else class="empty-state">Nenhuma vaga disponível no momento.</p>
</main>
</template>
Committable suggestion skipped: line range outside the PR's diff.
Foi adicionado uma listagem de candidatos. Conforme solicitado em uma tela em branco e com dados "Mockados" para simulação.
Summary by CodeRabbit
Novos Recursos
Mudanças de Interface
Dados