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

feat(more-info): adding question card and optional observation input #43

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a376f9
ci: add template issues, templates pr and ci for auto assign tasks
hxsggsz Dec 1, 2023
2189b50
refactor: add eof and fix project name
hxsggsz Dec 4, 2023
5723c64
refactor: remove create branch assign workflows
hxsggsz Dec 4, 2023
b640347
feat: update more info card
geisabitt Jan 12, 2024
3674aa8
feat: add cards questions and list dinamic vaccine
geisabitt Jan 12, 2024
0fec67b
add prettier ignore
diogocaronte Nov 28, 2023
3747d51
run prettier
diogocaronte Nov 28, 2023
eba66d6
make counter works
diogocaronte Nov 28, 2023
ef5c007
chore: add commit lint, commitizien, husky, vitest and make build work
Alecell Dec 2, 2023
2e44d71
chore: some more changes
Alecell Dec 2, 2023
75643ef
initial project architecture (#10)
diogocaronte Dec 6, 2023
6414833
move utils to a new package
diogocaronte Dec 14, 2023
5b00c96
docs: created readme.md file (#12)
RafaelLimaC Dec 14, 2023
3461194
chore: add lint and pet-dex-utilities package
Alecell Dec 15, 2023
342cb86
build: remove login page from build pages on vite config
Alecell Dec 19, 2023
8711ea9
chore(deps): bump the all-minor-updates group with 5 updates (#31)
dependabot[bot] Dec 20, 2023
7591a6a
chore(deps-dev): bump vitest from 0.34.6 to 1.0.4 (#16)
dependabot[bot] Dec 23, 2023
e014c4f
chore: update pnpm-lock with its new dependencies
Alecell Dec 23, 2023
241f491
chore(deps-dev): bump the all-minor-updates group with 4 updates (#42)
dependabot[bot] Jan 2, 2024
e08618e
feat: create the input text component (#34)
MateusHenriquegringo Jan 8, 2024
e86e08a
Adicionado novos scripts no package e integrado stylelint com prettie…
PiluVitu Jan 8, 2024
3d0dcfe
chore(deps): bump the all-minor-updates group with 4 updates (#45)
dependabot[bot] Jan 9, 2024
5aeaaa4
Merge branch 'main' of https://github.com/geisabitt/pet-dex-frontend …
geisabitt Jan 19, 2024
b6a088a
Merge branch 'main' of https://github.com/devhatt/pet-dex-frontend in…
geisabitt Jan 19, 2024
38d4ed0
ci: add template issues, templates pr and ci for auto assign tasks
hxsggsz Dec 1, 2023
1e3be19
merge main com a issue-30
geisabitt Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ updates:
versioning-strategy: increase
groups:
all-minor-updates:
update-types: ['minor', 'patch']
update-types: ['minor', 'patch']
23 changes: 11 additions & 12 deletions .github/workflows/autoAssigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- name: Check for "EU QUERO!!!" comment
if: contains(github.event.comment.body, 'EU QUERO!!!')
run: |
# Extract the commenter's username
commenter=$(jq -r .comment.user.login $GITHUB_EVENT_PATH)

# Add the commenter as an assignee to the issue using a Personal Access Token
echo "Assigning $commenter to the issue..."
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"assignees\": [\"$commenter\"]}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees"

- name: Check for "EU QUERO!!!" comment
if: contains(github.event.comment.body, 'EU QUERO!!!')
run: |
# Extract the commenter's username
commenter=$(jq -r .comment.user.login $GITHUB_EVENT_PATH)

# Add the commenter as an assignee to the issue using a Personal Access Token
echo "Assigning $commenter to the issue..."
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"assignees\": [\"$commenter\"]}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees"
41 changes: 20 additions & 21 deletions .github/workflows/autoMilestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ jobs:
auto-assign-milestone:
runs-on: ubuntu-latest
steps:
- name: Check for issue creation
run: |
# Extract the milestone name you want to assign
milestone="primeira página"

# Add the milestone to the issue
echo "Assigning milestone $milestone to the issue..."
curl -X PATCH -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"milestone\": \"$milestone\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}"
- name: Add a comment to the issue
run: |
# Comment to be added
comment="### Obrigado por abrir a issue\n### Verifique os nossos guidelines:\n- [Código de conduta](https://github.com/Alecell/octopost/blob/master/CODE_OF_CONDUCT.md)\n- [Contribuição](https://github.com/Alecell/octopost/blob/master/CONTRIBUTING.md)\n- [Guia de Estilo](https://github.com/Alecell/octopost/blob/master/STYLEGUIDE.md)"

# Add the comment to the issue
echo "Adding comment to the issue..."
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"body\": \"$comment\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"

- name: Check for issue creation
run: |
# Extract the milestone name you want to assign
milestone="primeira página"

# Add the milestone to the issue
echo "Assigning milestone $milestone to the issue..."
curl -X PATCH -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"milestone\": \"$milestone\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}"
- name: Add a comment to the issue
run: |
# Comment to be added
comment="### Obrigado por abrir a issue\n### Verifique os nossos guidelines:\n- [Código de conduta](https://github.com/Alecell/octopost/blob/master/CODE_OF_CONDUCT.md)\n- [Contribuição](https://github.com/Alecell/octopost/blob/master/CONTRIBUTING.md)\n- [Guia de Estilo](https://github.com/Alecell/octopost/blob/master/STYLEGUIDE.md)"

# Add the comment to the issue
echo "Adding comment to the issue..."
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-d "{\"body\": \"$comment\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
3 changes: 3 additions & 0 deletions src/components/more-info/assets/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/more-info/assets/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/components/more-info/assets/shield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/components/more-info/assets/stethoscope.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/components/more-info/assets/vaccine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions src/components/more-info/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import './index.scss';

import { Component } from 'pet-dex-utilities';
import InputText from '../TextInput/index';

const mockVaccines = [
{
year: 2023,
vaccine: 'Antirrábica',
date: '11-02-2023',
doctor: 'Felipa',
},
{
year: 2023,
vaccine: 'Raiva',
date: '11-02-2023',
doctor: 'Felipa',
},
{
year: 2023,
vaccine: 'Leptospirose',
date: '12-03-2023',
doctor: 'Felipa',
},
{
year: 2023,
vaccine: 'Bordetella',
date: '15-04-2023',
doctor: 'Felipa',
},
{
year: 2023,
vaccine: 'Giardia',
date: '06-10-2023',
doctor: 'Felipa',
},
];

const html = `
<div class="more-info-container">
<div class="more-info-header">
<h3 class="more-info-header__title">Conte-nos um pouco mais do seu animal</h3>
<h4 class="more-info-header__sub-title">Seu pet já foi vacinado? Conta pra gente que mês ou ano que você costuma comemorar o aniversário dele!</h4>
</div>
<div class="more-info-card">
<div class="more-info-card__description">
<img src="../components/more-info/assets/stethoscope.svg" alt="stethoscope" class="more-info-card__description__icon">
<h3 class="more-info-card__description__title">O seu pet amigo foi castrado?</h3>
</div>
<div class="more-info-card__input-group">
<div class="more-info-card__input-group__checkbox-group">
<input type="radio" id="castrado_false" name="castrado">
<label class="label-check-radios" for="castrado_false">
<span class="checkmark"></span>Não</label>
</div>
<div class="more-info-card__input-group__checkbox-group">
<input type="radio" id="castrado_true" name="castrado">
<label class="label-check-radios" for="castrado_true">
<span class="checkmark"></span>Sim</label>
</div>
</div>
</div>
<div class="more-info-card">
<div class="more-info-card__description">
<img src="../components/more-info/assets/shield.svg" alt="shield" class="more-info-card__description__icon">
<h3 class="more-info-card__description__title">Cuidados especiais</h3>
</div>
<div class="more-info-card__input-group">
<div class="more-info-card__input-group__checkbox-group">
<input type="radio" id="cuidados_False" name="cuidados">
<label class="label-check-radios" for="cuidados_False">
<span class="checkmark"></span>Não</label>
</div>
<div class="more-info-card__input-group__checkbox-group">
<input type="radio" id="cuidados_true" name="cuidados">
<label class="label-check-radios" for="cuidados_true">
<span class="checkmark"></span>Sim</label>
</div>
</div>
<label class="label-cuidado">Escreva o cuidado especial</label>
<div data-select="input_text" class="more-info__card-text-group">
</div>
</div>
<div class="more-info-card">
<div class="more-info-card__description">
<img src="../components/more-info/assets/vaccine.svg" alt="vaccine" class="more-info-card__description__icon">
<h3 class="more-info-card__description__title">Vacinas</h3>
</div>
<div class="more-info-card__input-group">
<button class='button_add'>
<img src="../components/more-info/assets/plus.svg" alt="plus" class="more-info-card__description__icon">
Adicionar
</button>
</div>
</div>
<div data-select="render-vaccines" class="render-vaccines">
</div>
</div>`;

export default function CardPet() {
Component.call(this, { html });
const inputText = new InputText({
placeholder: 'Escreva o cuidado especial',
variation: 'outlined',
});
const inputContainer = this.selected.get('input_text');

inputText.mount(inputContainer);

if (!mockVaccines) {
// eslint-disable-next-line prettier/prettier
Copy link
Contributor

Choose a reason for hiding this comment

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

Verificar se ainda precisa desse comentario atualizando a branch

this.selected.get('render-vaccines').innerText = 'Nenhuma vacina cadastrada.';
} else {
// eslint-disable-next-line no-inner-declarations
Copy link
Contributor

Choose a reason for hiding this comment

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

Verificar se ainda rpecisa desse comentário com a atualização da branch

function cardVaccine(year, vaccine, date, doctor) {
const cardVaccineHtml = `
<p class="vaccines-container__year">${year}</p>
<div class="vaccines-group">
<p class="vaccines-group__title">${vaccine}</p>
<div class="vaccines-group__date-group">
<img src="../components/more-info/assets/calendar.svg" alt="calendar" class="vaccines-group__date-group__icon">
Copy link
Contributor

Choose a reason for hiding this comment

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

Importar imagem da pasta local do seu componente, não da pasta assets

<p class="vaccines-group__date-group__date">${date}</p>
</div>
<p class="vaccines-group__doctor">Dr. ${doctor}</p></div>`;
return cardVaccineHtml;
}
const vaccinesContainer = this.selected.get('render-vaccines');
const dataVaccines = () => {
//preciso de ajuda para não precisar desabilitar a regra
// eslint-disable-next-line no-restricted-syntax
Copy link
Contributor

Choose a reason for hiding this comment

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

Atualizando a branch provavelmente vai resolver

for (const item of mockVaccines) {
//preciso de ajuda para não precisar desabilitar a regra
// eslint-disable-next-line prettier/prettier
Copy link
Contributor

Choose a reason for hiding this comment

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

Atualizando a branch provavelmente vai resolver

const createCardVaccine = cardVaccine(item.year, item.vaccine, item.date, item.doctor);
const divVaccines = document.createElement('div');
Copy link
Contributor

Choose a reason for hiding this comment

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

quando temos no js elementos que são tags, não dados de js, usamos o pattern de usar $ na declaração do elemento como $vaccines

No caso tambem não é uma boa pratica chamar a variavel com o nome ta tag que ela tem, seria melhor um $vaccinesContainer doque um $divVaccines

divVaccines.classList.add('vaccines-container');
divVaccines.innerHTML = createCardVaccine;
vaccinesContainer.appendChild(divVaccines);
}
};
dataVaccines();
}
}

CardPet.prototype = Object.assign(CardPet.prototype, Component.prototype);
Loading