-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from ijun17/feature-fe-#15#16#31#41#162
[FE] feat#15#16#31#41#162 νλ μ΄μ΄ λλ€μ μ λ ₯μ°½ λ° κ²μ λκΈ°λ°© λ μ΄μμ κ°λ°
- Loading branch information
Showing
22 changed files
with
591 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Deploy To EC2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
# defaults: | ||
# run: | ||
# working-directory: ./BE # BE λλ ν 리λ₯Ό μμ λλ ν λ¦¬λ‘ μ€μ | ||
|
||
steps: | ||
- name: Github Repository νμΌ λΆλ¬μ€κΈ° | ||
uses: actions/checkout@v4 | ||
|
||
- name: Node μ€μΉ | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
|
||
- name: BE μμ‘΄μ± μ€μΉ | ||
working-directory: ./BE | ||
run: npm ci | ||
|
||
- name: FE μμ‘΄μ± μ€μΉ | ||
working-directory: ./FE | ||
run: npm ci | ||
|
||
- name: .env νμΌ λ§λ€κΈ° | ||
run: | | ||
echo '${{ secrets.ENV }}' > .env | ||
- name: ν μ€νΈ μ½λ μ€ν | ||
run: npm run test | ||
|
||
- name: λΉλ | ||
run: npm run build | ||
|
||
- name: github-action μ»΄ν¨ν°μμ μμΆνκΈ° | ||
run: | | ||
# νμ¬ μμΉ νμΈ (λλ²κΉ μ©) | ||
pwd | ||
# BEμ FE λͺ¨λ νμ νμΌλ€μ ν¨κ» μμΆ | ||
tar -czvf project.tar.gz \ | ||
BE/dist \ | ||
BE/package.json \ | ||
BE/package-lock.json \ | ||
BE/.env \ | ||
FE/build \ | ||
FE/package.json \ | ||
FE/package-lock.json \ | ||
FE/.env | ||
# μμΆ νμΌ λ΄μ© νμΈ (λλ²κΉ μ©) | ||
echo "Created archive with contents:" | ||
tar -tvf project.tar.gz | ||
- name: SCPλ‘ EC2μ λΉλλ νμΌ μ μ‘νκΈ° | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
source: project.tar.gz | ||
target: /root/nest-server/tobe | ||
|
||
- name: SSHλ‘ EC2μ μ μνκΈ° | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script_stop: true | ||
script: | | ||
rm -rf /root/nest-server/current | ||
mkdir /root/nest-server/current | ||
mv /root/nest-server/tobe/project.tar.gz /root/nest-server/current/project.tar.gz | ||
cd /root/nest-server/current | ||
tar -xvf project.tar.gz | ||
npm i | ||
pm2 kill | ||
pm2 start dist/main.js --name "backend-server" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { socketService } from '@/api/socket'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
const sampleChat = Array(100) | ||
.fill(null) | ||
.map((_, i) => ({ name: 'user' + i, message: 'messagemessagemessagemessagemessagemessage' })); | ||
|
||
const Chat = () => { | ||
const [messages, setMessages] = useState<Array<{ name: string; message: string }>>([]); | ||
const [inputValue, setInputValue] = useState(''); | ||
|
||
useEffect(() => { | ||
setMessages(sampleChat); //TODO λμ€μ κ³ μ³μΌ ν¨ | ||
// μλ²μμ λ©μμ§λ₯Ό λ°μ λ | ||
// socket.on('chat message', (message) => { | ||
// setMessages((prevMessages) => [...prevMessages, message]); | ||
// }); | ||
// return () => { | ||
// socket.off('chat message'); | ||
// }; | ||
}, []); | ||
|
||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setInputValue(e.target.value); | ||
}; | ||
|
||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
if (inputValue.trim()) { | ||
socketService.chatMessage('1234', inputValue); | ||
setInputValue(''); | ||
} | ||
}; | ||
return ( | ||
<div className="component-default h-[100%]"> | ||
<div className="border-b border-default center h-[2.5rem]">λ©μμ§</div> | ||
<div className="p-2 h-[calc(100%-6rem)] overflow-y-scroll"> | ||
{messages.map((e, i) => ( | ||
<div className="break-words leading-5 mt-3" key={i}> | ||
<span className="font-bold mr-2">{e.name}</span> | ||
<span>{e.message}</span> | ||
</div> | ||
))} | ||
</div> | ||
<div className="center border-t border-default h-[3.5rem] p-2"> | ||
<form onSubmit={handleSubmit} className="w-full h-full"> | ||
<input | ||
className="bg-[#0001] w-[100%] h-[100%] rounded-m p-2" | ||
type="text" | ||
placeholder="λ©μμ§" | ||
value={inputValue} | ||
onChange={handleInputChange} | ||
/> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Chat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Button } from '@mui/material'; | ||
|
||
type ClipboardCopyProps = { | ||
valueToCopy: string; | ||
message: string; | ||
className?: string; | ||
}; | ||
|
||
export const ClipboardCopy: React.FC<ClipboardCopyProps> = ({ valueToCopy, message }) => { | ||
const handleCopyToClipboard = (): void => { | ||
navigator.clipboard | ||
.writeText(valueToCopy) | ||
.then(() => { | ||
alert('ν΄λ¦½λ³΄λμ 볡μ¬λμμ΅λλ€: '); | ||
}) | ||
.catch((err) => { | ||
console.error('λ³΅μ¬ μ€ν¨:', err); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Button onClick={handleCopyToClipboard}>{message}</Button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ClipboardCopy } from './ClipboardCopy'; | ||
import Card from '@mui/material/Card'; | ||
import { QuizPreview } from './QuizView'; | ||
|
||
export const GameHeader = () => { | ||
// μμκ° | ||
const pinNum = '123456'; | ||
const linkURL = 'naver.com'; | ||
return ( | ||
<Card className="p-4 border border-blue-600 shadow-xl rounded-md h-[280px] w-[1000px] bg-gradient-to-b from-blue-500 to-blue-700 text-white"> | ||
<div className="flex justify-center mb-4"> | ||
<ClipboardCopy valueToCopy={pinNum} message={`PIN: ${pinNum} 볡μ¬`} /> | ||
<ClipboardCopy valueToCopy={linkURL} message="곡μ λ§ν¬ 볡μ¬" /> | ||
</div> | ||
<div className="flex flex-col items-center justify-center text-center space-y-2"> | ||
<span className="text-xl font-semibold">ν΄μ¦μ΄λ¦22</span> | ||
</div> | ||
<QuizPreview title="title" description="ν΄μ¦ν΄μ¦ν΄γ £μ¦" /> | ||
<div className="flex space-x-4 justify-center"> | ||
<button className="bg-yellow-400 text-black font-bold py-2 px-4 rounded-md shadow-lg transform hover:translate-y-[-2px] hover:shadow-xl active:translate-y-1 active:shadow-sm transition"> | ||
ν΄μ¦ μ€μ | ||
</button> | ||
<button className="bg-blue-500 text-white font-bold py-2 px-4 rounded-md shadow-lg transform hover:translate-y-[-2px] hover:shadow-xl active:translate-y-1 active:shadow-sm transition"> | ||
κ²μ μμ | ||
</button> | ||
</div> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const HeaderBar = () => { | ||
return ( | ||
<header className="h-[100px] text-l leading-[100px] pl-8 font-bold bg-main text-white"> | ||
QuizGround | ||
</header> | ||
); | ||
}; |
Oops, something went wrong.