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

Adicionar listagem de candidatos #2

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

Conversation

thalesfranklin
Copy link

@thalesfranklin thalesfranklin commented Jan 23, 2025

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

    • Implementada uma nova visualização de vagas com detalhes como posição, produto, data de candidatura, número de candidatos e prioridade
    • Adicionada uma lista dinâmica de vagas com cartões individuais
  • Mudanças de Interface

    • Redesenhada a estrutura da página principal
    • Substituída a navegação anterior por uma lista de vagas
  • Dados

    • Criado um novo conjunto de dados de vagas em formato JSON
    • Incluídos detalhes de quatro posições diferentes de produto

Copy link

coderabbitai bot commented Jan 23, 2025

Walkthrough

As alterações envolvem uma reformulação significativa do src/App.vue, substituindo a estrutura de navegação anterior por uma exibição dinâmica de vagas de emprego. Um novo arquivo JSON vancacyMok.json foi adicionado para fornecer dados de vagas. A aplicação agora renderiza cartões de vagas usando um v-for, mostrando detalhes como posição, produto, data de candidatura, número de candidatos e prioridade. A sintaxe do script foi alterada para uma exportação padrão, e estilos foram ajustados para refletir as mudanças na interface.

Changes

Arquivo Resumo das Alterações
src/App.vue - Substituição do template de navegação por listagem de vagas
- Mudança da sintaxe <script setup> para exportação padrão
- Remoção de importações relacionadas a navegação e autenticação
- Adição de nova lógica de renderização de vagas a partir de dados JSON
- Modificação dos estilos para cartões de vagas
src/components/data/vancacyMok.json - Criação de novo arquivo JSON
- Inclusão de dados de 4 vagas de emprego com campos como id, posição, produto, data de candidatura, candidatos e prioridade

Poem

🐰 Vagas, vagas, que alegria!
Cartões dançando com maestria
Dados JSON, um novo olhar
Código que veio para brilhar
Coelhada tech em plena harmonia! 🚀


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 23, 2025

Deploy Preview for soujunior-stars ready!

Name Link
🔨 Latest commit e97fc68
🔍 Latest deploy log https://app.netlify.com/sites/soujunior-stars/deploys/67980d87283abc0008af407a
😎 Deploy Preview https://deploy-preview-2--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: 2

🧹 Nitpick comments (2)
src/App.vue (2)

19-28: Adicionar validação de dados e melhorar a estrutura do componente

O 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 visual

O 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

📥 Commits

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

📒 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"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
v-for="vacancies in vacancies"
v-for="vacancy in vacancies"

src/App.vue Outdated
Comment on lines 2 to 16
<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>
Copy link

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.

Suggested change
<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>

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

🧹 Nitpick comments (2)
src/App.vue (2)

21-30: Sugestões de melhorias para o script

Algumas sugestões para melhorar a manutenibilidade do código:

  1. 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,
    };
  },
};
  1. Remova o comentário redundante da linha 27, pois a origem dos dados já está clara pelo import.

32-52: Melhorar a manutenibilidade dos estilos

Sugestõ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

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd4fba and 1affdf7.

📒 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">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
<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)

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 (2)
src/App.vue (2)

7-11: Externalizar strings para facilitar internacionalização

As 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 temas

Os 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>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1affdf7 and e97fc68.

📒 Files selected for processing (1)
  • src/App.vue (1 hunks)

Comment on lines +21 to +30
<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
};
},
};
Copy link

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.

Comment on lines +4 to +17
<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>
Copy link

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.

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