Skip to content

Commit

Permalink
Merge pull request #296 from NUTFes/dev/issue291
Browse files Browse the repository at this point in the history
Dev/issue291 Particpantcardコンポーネントの作成
  • Loading branch information
TsubasaOura authored Mar 4, 2023
2 parents 02fb2fc + 2ac78be commit 1da3edd
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 11 deletions.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ services:
- '6006:6006'
volumes:
- ./view:/app/next-project
environment:
SSR_API_URI: 'http://go:1323/api'
CSR_API_URI: 'http://localhost:1323'
command: sh -c 'npm run dev & npm run storybook'
depends_on:
- go
Expand Down
21 changes: 14 additions & 7 deletions go_api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"net/http"
"os"
// "os"

_ "github.com/NUTFes/lottery/go_api/docs"
"github.com/NUTFes/lottery/go_api/infrastructure"
Expand Down Expand Up @@ -38,6 +38,13 @@ func main() {
// DB接続
client := infrastructure.ConnectDB()

// cors設定
arrowOrigins := []string{"http://localhost:3000"}
e.Use(middleware.Logger())
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: arrowOrigins,
}))

// 依存の方向:controller -> usecase -> domain <- infrastructure
adminInfrastructure := infrastructure.NewAdminInfrastructure(client)
eventInfrastructure := infrastructure.NewEventInfrastructure(client)
Expand All @@ -60,12 +67,12 @@ func main() {
// ルーティング(APIが増えると、server.goが肥大化するので、今後別にファイルに分ける)

// BasicAuth
e.Use(middleware.BasicAuth(func(username string, password string, c echo.Context) (bool, error) {
if username == os.Getenv("ADMIN_NAME") && password == os.Getenv("ADMIN_PASS") {
return true, nil
}
return false, nil
}))
// e.Use(middleware.BasicAuth(func(username string, password string, c echo.Context) (bool, error) {
// if username == os.Getenv("ADMIN_NAME") && password == os.Getenv("ADMIN_PASS") {
// return true, nil
// }
// return false, nil
// }))

// admins
e.GET("/admins", adminController.IndexAdmin)
Expand Down
4 changes: 4 additions & 0 deletions view/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
env: {
SSR_API_URI: process.env.SSR_API_URI,
CSR_API_URI: process.env.CSR_API_URI,
}
}

module.exports = nextConfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Default.args = {
participantType: 'all',
}

Default.storyName = 'Default'
Default.storyName = 'デフォルト'
2 changes: 1 addition & 1 deletion view/src/components/common/Card/EventParticipantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CardContent from '@mui/material/CardContent'
import Typography from '@mui/material/Typography'
import { CardActionArea } from '@mui/material'
import { EventParticipantCardProps } from './EventParticipantCard.type'
import { useMemo } from 'react'
import { useState, useEffect, useMemo } from 'react'

const EventParticipantCard = (props: EventParticipantCardProps) => {
const { participantType, participantParsent, participantCount } = props
Expand Down
2 changes: 1 addition & 1 deletion view/src/components/common/Header/AdminHeader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const Template: ComponentStory<typeof AdminHeader> = (args) => <AdminHeader {...

export const Default: ComponentStory<typeof AdminHeader> = Template.bind({})

Default.storyName = 'Default'
Default.storyName = 'デフォルト'
1 change: 1 addition & 0 deletions view/src/components/layout/MainLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './MainLayout';
1 change: 0 additions & 1 deletion view/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'src/styles/globals.css'
import '/src/styles/globals.css'
import type { AppProps } from 'next/app'

export default function App({ Component, pageProps }: AppProps) {
Expand Down

0 comments on commit 1da3edd

Please sign in to comment.