Skip to content

Commit

Permalink
Merge pull request #258 from Link-MIND/feat/#256
Browse files Browse the repository at this point in the history
feature(admin.html): ํŽ˜์ด์ง€ ์˜ฌ๋ผ๊ฐ€๋Š”์ง€ ํ™•์ธ
  • Loading branch information
sss4920 authored Feb 3, 2025
2 parents 3ae6447 + 0ec709e commit 1b66082
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 0 deletions.
22 changes: 22 additions & 0 deletions linkmind/src/main/resources/templates/basic/admin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค</title>
</head>
<body>
<h1 id="welcomeMessage"></h1> <!-- ID๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ JavaScript์—์„œ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•จ -->
</body>

<script>
// ์„ธ์…˜ ์Šคํ† ๋ฆฌ์ง€์—์„œ userName์„ ๊ฐ€์ ธ์˜ด
const userName = sessionStorage.getItem('userName');

// userName์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ ํ™˜์˜ ๋ฉ”์‹œ์ง€๋ฅผ ์„ค์ •
if (userName) {
document.getElementById('welcomeMessage').innerText = userName + '๋‹˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!';
} else {
document.getElementById('welcomeMessage').innerText = 'ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!';
}
</script>
</html>
47 changes: 47 additions & 0 deletions linkmind/src/main/resources/templates/basic/linkListPage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Links</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
.link-container {
display: flex;
flex-direction: column;
margin: 20px;
}

.link-item {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
margin: 5px 0;
display: flex;
align-items: center;
}

.link-thumbnail {
width: 50px;
height: 50px;
margin-right: 10px;
border-radius: 5px;
}

.link-title {
font-size: 18px;
}
</style>
</head>
<body>
<div th:if="${links.size() == 0}">
<h3>๋งํฌ๊ฐ€ ํ˜„์žฌ ์—†์Šต๋‹ˆ๋‹ค!</h3>
</div>
<div class="link-container">
<h1>Links List</h1>
<div th:each="link : ${links}" class="link-item">
<img th:src="${link.thumbnailUrl}" alt="Thumbnail" class="link-thumbnail"/>
<span class="link-title" th:text="${link.title}"></span>
</div>
</div>
</body>
</html>
101 changes: 101 additions & 0 deletions linkmind/src/main/resources/templates/basic/qrForm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>์ž…๋ ฅํผ ํŽ˜์ด์ง€</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f8ff; /* ๋ฐฐ๊ฒฝ์ƒ‰ ์กฐ์ • ๊ฐ€๋Šฅ */
}

.form-container {
text-align: center;
}

.input-field {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
font-size: 1rem;
width: 300px;
margin-bottom: 15px;
}

.submit-button {
background-color: #add8e6; /* ์—ฐํ•œ ํŒŒ๋ž€์ƒ‰ */
border: none;
border-radius: 5px;
color: white;
padding: 15px 30px;
font-size: 1.2rem;
cursor: pointer;
transition: background-color 0.3s;
}

.submit-button:hover {
background-color: #87ceeb; /* ๋ฒ„ํŠผ ํ˜ธ๋ฒ„ ์ƒ‰์ƒ */
}
</style>
</head>
<body>


<h1>QR ์ฝ”๋“œ๋ฅผ ๊ด€๋ฆฌ์ž ๋””์Šค์ฝ”๋“œ์—์„œ ๋“ฑ๋กํ•˜์…จ๋‚˜์š”?</h1>

<div class="form-container">

<h2>์ž…๋ ฅ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”!</h2>
<form id="codeForm">
<input type="text" class="input-field" placeholder="์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" id="code"/>
<br>
<button class="submit-button" type="submit">์ œ์ถœ</button>
</form>
</div>

<script>
document.getElementById('codeForm').addEventListener('submit', function(event) {
event.preventDefault(); // ๊ธฐ๋ณธ ํผ ์ œ์ถœ ๋ฐฉ์ง€

const code = document.getElementById('code').value;

// JSON ๋ฐ์ดํ„ฐ ์ƒ์„ฑ
const data = {
code: code,
};

// AJAX ์š”์ฒญ
fetch('/admin/verify-code', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
if (response.ok) {
return response.json();
}
throw new Error('๋„คํŠธ์›Œํฌ ์‘๋‹ต์ด ์ข‹์ง€ ์•Š์Šต๋‹ˆ๋‹ค.');
})
.then(data => {
console.log(data); // ์„œ๋ฒ„์—์„œ ๋ฐ˜ํ™˜ํ•œ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ
alert(data.data.userName); // ์˜ˆ๋ฅผ ๋“ค์–ด, ์„ฑ๊ณต ๋ฉ”์‹œ์ง€ ํ‘œ์‹œ
if (data.redirectUrl) { // ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URL์ด ์žˆ๋Š” ๊ฒฝ์šฐ
// userName์„ ์„ธ์…˜ ์Šคํ† ๋ฆฌ์ง€์— ์ €์žฅ
sessionStorage.setItem('userName', data.data.userName);
window.location.href = data.redirectUrl; // ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ
}
})
.catch(error => {
console.error('๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค:', error);
});
});
</script>

</body>
</html>
88 changes: 88 additions & 0 deletions linkmind/src/main/resources/templates/basic/register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>๋กœ๊ทธ์ธ ํŽ˜์ด์ง€</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f8ff; /* ๋ฐฐ๊ฒฝ์ƒ‰ ์กฐ์ • ๊ฐ€๋Šฅ */
}

.form-container {
text-align: center;
border: 1px solid #ccc;
border-radius: 10px;
padding: 20px;
background-color: white;
}

.input-field {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
font-size: 1rem;
width: 300px;
margin-bottom: 15px;
}

.submit-button {
background-color: #add8e6; /* ์—ฐํ•œ ํŒŒ๋ž€์ƒ‰ */
border: none;
border-radius: 5px;
color: white;
padding: 15px 30px;
font-size: 1.2rem;
cursor: pointer;
transition: background-color 0.3s;
}

.submit-button:hover {
background-color: #87ceeb; /* ๋ฒ„ํŠผ ํ˜ธ๋ฒ„ ์ƒ‰์ƒ */
}
</style>
</head>
<body>

<div class="form-container">
<h1>๋กœ๊ทธ์ธ</h1>
<form id="loginForm" th:action="@{/admin/register}" method="post" onsubmit="submitForm(event)">
<input type="text" class="input-field" placeholder="์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" th:name="'username'" required/>
<br>
<input type="password" class="input-field" placeholder="๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" th:name="'password'" required/>
<br>
<button class="submit-button" type="submit">๋กœ๊ทธ์ธ</button>
</form>
</div>

<script>
async function submitForm(event) {
event.preventDefault(); // ๊ธฐ๋ณธ ํผ ์ œ์ถœ ๋ฐฉ์ง€

const formData = new FormData(document.getElementById('loginForm'));
const jsonData = Object.fromEntries(formData.entries()); // FormData๋ฅผ JSON์œผ๋กœ ๋ณ€ํ™˜

const response = await fetch('/admin/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json' // JSON ํ˜•์‹์œผ๋กœ ์ „์†ก
},
body: JSON.stringify(jsonData) // JSON ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜
});

if (response.ok) {
const data = await response.json();
window.location.href = data.redirectUrl; // ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ URL๋กœ ์ด๋™
} else {
// ์˜ค๋ฅ˜ ์ฒ˜๋ฆฌ
console.error('Registration failed:', response.statusText);
}
}
</script>

</body>
</html>
42 changes: 42 additions & 0 deletions linkmind/src/main/resources/templates/basic/text-basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>๋ฒ„ํŠผ ์„ ํƒ ํŽ˜์ด์ง€</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f8ff; /* ๋ฐฐ๊ฒฝ์ƒ‰ ์กฐ์ • ๊ฐ€๋Šฅ */
}
.button-container {
text-align: center;
}
.button {
background-color: #add8e6; /* ์—ฐํ•œ ํŒŒ๋ž€์ƒ‰ */
border: none;
border-radius: 5px;
color: white;
padding: 15px 30px;
font-size: 1.2rem;
cursor: pointer;
transition: background-color 0.3s;
}
.button:hover {
background-color: #87ceeb; /* ๋ฒ„ํŠผ ํ˜ธ๋ฒ„ ์ƒ‰์ƒ */
}
</style>
</head>
<body>

<div class="button-container">
<button class="button" th:onclick="|location.href='@{/basic/hi}'|" type="button">๊ฐœ๋ฐœ์ž ๋ฐฑ ์˜คํ”ผ์Šค</button>
<br><br>
<button class="button" th:onclick="|location.href='@{/swagger-ui/index.html#/}'|" type="button">์†๋‹˜</button>
</div>

</body>
</html>

0 comments on commit 1b66082

Please sign in to comment.