Skip to content

Commit 0d99c8c

Browse files
Merge pull request #107 from socraticDevBlog/#106-clientweb
refactor: supprimer la fonction de collage et l'événement associé du …
2 parents b7ed35a + 462ac55 commit 0d99c8c

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- "*"
66
paths-ignore:
7+
- 'client/web/**'
78
- "backend/**"
89
jobs:
910
build:

.github/workflows/pytest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- "*"
77
paths-ignore:
8+
- 'client/web/**'
89
- "backend/**"
910
jobs:
1011
test:

.github/workflows/terraform.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- synchronize
77
- closed
88
paths-ignore:
9+
- 'client/web/**'
910
- "backend/**"
1011
permissions:
1112
id-token: write # This is required for aws oidc connection

client/web/index.html

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta name="environment" content="local" />
4+
<meta name="environment" content="production" />
55
<meta charset="UTF-8" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Pastebin</title>
@@ -11,13 +11,18 @@
1111
--text-color: black;
1212
--button-bg: #007bff;
1313
--button-hover: #0056b3;
14+
--submit-bg: #007bff; /* Blue color for Submit (default) */
15+
--submit-hover: #0056b3; /* Darker blue for hover */
16+
--font-size: 16px;
1417
}
1518

1619
body.dark-mode {
1720
--bg-color: #121212;
1821
--text-color: #ffffff;
1922
--button-bg: #ff9800;
2023
--button-hover: #e68900;
24+
--submit-bg: #ff9800; /* Dark mode submit color */
25+
--submit-hover: #e68900;
2126
}
2227

2328
body {
@@ -82,6 +87,28 @@
8287
#toggleModeButton:hover {
8388
background-color: var(--button-hover);
8489
}
90+
91+
/* Submit Button Styling */
92+
button {
93+
font-size: 18px;
94+
padding: 12px 20px;
95+
margin-top: 10px;
96+
background-color: var(--submit-bg);
97+
color: white;
98+
border: none;
99+
border-radius: 8px;
100+
cursor: pointer;
101+
transition: background-color 0.3s ease, transform 0.2s ease;
102+
}
103+
104+
button:hover {
105+
background-color: var(--submit-hover);
106+
transform: scale(1.05);
107+
}
108+
109+
button:active {
110+
transform: scale(1);
111+
}
85112
</style>
86113
</head>
87114
<body>
@@ -92,13 +119,12 @@ <h1>Pastebin</h1>
92119
<textarea
93120
id="pasteContent"
94121
placeholder="Paste your text here..."
95-
onclick="paste(this)"
96122
></textarea>
97123
<br />
98124
<button onclick="submitText()">Submit</button>
99125
<div id="responseContainer"></div>
100126
<h2>latest pastes</h2>
101127
<div id="latestPasteUrls"></div>
102-
<script src="script.js"></script>
128+
<script src="pastebinscript.js"></script>
103129
</body>
104130
</html>

client/web/script.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ async function submitText() {
2424
let content;
2525
if (textData) {
2626
content = textData;
27-
console.log(`content: {content}`);
2827
} else {
2928
alert("Please enter text to be saved");
3029
return;
@@ -118,11 +117,6 @@ async function displayPasteUrls() {
118117
}
119118
}
120119

121-
async function paste(input) {
122-
const text = await navigator.clipboard.readText();
123-
input.value = text;
124-
}
125-
126120
function toggleMode() {
127121
document.body.classList.toggle("dark-mode");
128122
const isDark = document.body.classList.contains("dark-mode");
@@ -134,15 +128,6 @@ function toggleMode() {
134128
document.getElementById("toggleModeButton").innerHTML = isDark ? "☀️" : "🌙";
135129
}
136130

137-
document
138-
.getElementById("pasteContent")
139-
.addEventListener("keydown", function (event) {
140-
if (event.key === "Enter" && !event.shiftKey) {
141-
event.preventDefault(); // Prevents adding a new line
142-
submitText(); // Triggers submit
143-
}
144-
});
145-
146131
window.onload = function () {
147132
displayPasteUrls();
148133
const darkModeSetting = localStorage.getItem("darkMode");
@@ -153,4 +138,5 @@ window.onload = function () {
153138
} else {
154139
document.getElementById("toggleModeButton").innerHTML = "🌙";
155140
}
141+
document.getElementById("pasteContent").focus();
156142
};

0 commit comments

Comments
 (0)