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

Verificado #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions .github/workflows/azure-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to Azure
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build and deploy Container App
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
acrName: ${{ vars.AZURE_PREFIX }}acr
resourceGroup: ${{ vars.AZURE_RG }}
containerAppName: ${{ vars.AZURE_PREFIX }}containerapp
24 changes: 24 additions & 0 deletions .github/workflows/create-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Create Azure resources
on: [workflow_dispatch]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:

# Checkout codes
- uses: actions/checkout@main

# Log into Azure
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

# Deploy Bicep file
- name: create resources
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ vars.AZURE_RG }}
template: ${{ github.workspace }}/config/main.bicep
parameters: 'namePrefix=${{ vars.AZURE_PREFIX }}'
failOnStdErr: false
2 changes: 1 addition & 1 deletion config/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ resource containerApp 'Microsoft.App/containerApps@2022-03-01' = {
configuration: {
ingress: {
external: true
targetPort: 80
targetPort: 3000
allowInsecure: false
traffic: [
{
Expand Down
33 changes: 32 additions & 1 deletion src/components/Hours.js
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
// Placeholder to host a component
import React from "react";

const Hours = () => {
// add logic

const shelterHours = [
{ day: "Monday", open: "10:00", close: "16:00" },
{ day: "Tuesday", open: "10:00", close: "16:00" },
{ day: "Wednesday", open: "10:00", close: "16:00" },
{ day: "Thursday", open: "10:00", close: "16:00" },
{ day: "Friday", open: "10:00", close: "16:00" },
{ day: "Saturday", open: "9:00", close: "20:00" },
{ day: "Sunday", open: "9:00", close: "20:00" },

]

// get the long day name and store it in a variable called today
const today = new Date().toLocaleDateString('en-US', { weekday: 'long' });

// get today's hours
const todayHours = shelterHours.find((day) => day.day === today);

// display today and the hours in an div with an id of hours
return (
<div id="hours">
<h2>Horario:</h2>
<p>{todayHours.day} {todayHours.open} - {todayHours.close}</p>
</div>
)
}

export default Hours;
8 changes: 8 additions & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,11 @@ li {
h1 {
text-align: center;
}

.author {
font-size: 22px;
font-weight: bold;
background: #8e24aa;
color: #fff;
width: 270px;
}
11 changes: 7 additions & 4 deletions src/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function MyApp({ Component, pageProps }) {
return (
<>
<Head>
<title>Pet Care App</title>
<title>Pet Care App - By Carlos Gonzalez</title>
</Head>

<div className="top-bar">
<div className="nav">
<Link href="/">
Home
Inicio
</Link>
<Link href="/new">
Add Pet
Agregar Mascota
</Link>
</div>

Expand All @@ -25,8 +25,11 @@ function MyApp({ Component, pageProps }) {
src="https://upload.wikimedia.org/wikipedia/commons/1/1f/Pet_logo_with_flowers.png"
alt="pet care logo"
></img>
<div>
<p className="author">Autor: Carlos J. Gonzalez</p>
</div>
</div>
<h1>Adoption shelter</h1>
<h1>Refugio de Adopción</h1>
<div className="grid wrapper">
<Component {...pageProps} />
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import dbConnect from "../lib/dbConnect";
import Pet from "../models/Pet";

// TODO: Import Hours component
import Hours from "../components/Hours";

const Index = ({ pets }) => {

return (
<>

{/* TODO: Display Hours component */}
<Hours />

{/* Create a card for each pet */}
{pets.map((pet) => (
Expand Down Expand Up @@ -70,4 +72,4 @@ export async function getServerSideProps() {
return { props: { pets: pets } };
}

export default Index;
export default Index;