Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanna committed Nov 14, 2024
2 parents 5861f5a + 8510b84 commit 387a53c
Show file tree
Hide file tree
Showing 147 changed files with 9,804 additions and 0 deletions.
Binary file added assets/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions assets/css/bootstrap.min.css

Large diffs are not rendered by default.

1,205 changes: 1,205 additions & 0 deletions assets/css/style.css

Large diffs are not rendered by default.

Binary file added assets/fonts/ionicons.eot
Binary file not shown.
2,230 changes: 2,230 additions & 0 deletions assets/fonts/ionicons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fonts/ionicons.ttf
Binary file not shown.
Binary file added assets/fonts/ionicons.woff
Binary file not shown.
Binary file added assets/img/agency.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/client.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/face.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/favicon.ico
Binary file not shown.
Binary file added assets/img/img1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/post_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/serv.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/site-hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/site-hero2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ body {
background-size: cover;
}

.background-portfolio {
width: 100%;
background: #fff no-repeat;
background-size: cover;
position: relative;
background-image: url("../assets/img/site-hero.jpg"); /* Заміни 'your-image.jpg' на шлях до твого зображення */
}

.nav {
padding-top: 20px;
padding-bottom: 20px;
Expand Down
151 changes: 151 additions & 0 deletions js/admin 2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@

// async function fetchPendingReviews() {
// try {
// const response = await fetch('/api/reviews/pending'); // Запит на отримання несхвалених відгуків
// const reviews = await response.json();

// const reviewsContainer = document.getElementById('reviewsContainer');
// reviewsContainer.innerHTML = ''; // Очищуємо контейнер перед додаванням відгуків

// reviews.forEach(review => {
// const reviewElement = document.createElement('div');
// reviewElement.classList.add('review');
// reviewElement.innerHTML = `
// <p><strong>Ім'я:</strong> ${review.name}</p>
// <p><strong>Відгук:</strong> ${review.text}</p>
// <button onclick="approveReview('${review.id}', this)" ${review.approved ? 'disabled' : ''}>
// ${review.approved ? 'Схвалено' : 'Схвалити'}
// </button>
// <button onclick="deleteReview('${review.id}', this)">Видалити</button>
// `;
// reviewsContainer.appendChild(reviewElement);
// });
// } catch (error) {
// console.error('Помилка завантаження відгуків:', error);
// }
// }

// async function approveReview(reviewId, button) {
// try {
// const response = await fetch(`/api/reviews/approve/${reviewId}`, {
// method: 'PATCH',
// });

// if (response.ok) {
// alert('Відгук схвалено!');
// button.textContent = 'Схвалено';
// button.disabled = true; // Деактивуємо кнопку після схвалення
// } else {
// console.error('Помилка схвалення відгуку:', response.statusText);
// }
// } catch (error) {
// console.error('Помилка схвалення відгуку:', error);
// }
// }

// async function deleteReview(reviewId, button) {
// try {
// const response = await fetch(`/api/reviews/${reviewId}`, {
// method: 'DELETE',
// });

// if (response.ok) {
// alert('Відгук видалено!');
// // Видаляємо елемент відгуку з DOM
// button.parentElement.remove();
// } else {
// console.error('Помилка видалення відгуку:', response.statusText);
// }
// } catch (error) {
// console.error('Помилка видалення відгуку:', error);
// }
// }

// // Завантажуємо відгуки при завантаженні сторінки
// document.addEventListener('DOMContentLoaded', fetchPendingReviews);


async function fetchAllReviews() {
try {
const response = await fetch('/api/reviews'); // Запит на отримання всіх відгуків (схвалених і несхвалених)
const reviews = await response.json();

const reviewsContainer = document.getElementById('reviewsContainer');
reviewsContainer.innerHTML = ''; // Очищуємо контейнер перед додаванням відгуків

reviews.forEach(review => {
const reviewElement = document.createElement('div');
reviewElement.classList.add('review');
reviewElement.innerHTML = `
<p><strong>Ім'я:</strong> ${review.name}</p>
<p class="review-text"><strong>Відгук:</strong> ${review.text}</p>
<button class="approve-button" onclick="approveReview('${review.id}', this)" ${review.approved ? 'disabled' : ''}>
${review.approved ? 'Схвалено' : 'Схвалити'}
</button>
<button class="delete-button" onclick="deleteReview('${review.id}', this)">Видалити</button>
`;

const reviewText = reviewElement.querySelector('.review-text');

// Додаємо кнопку "Читати далі", якщо текст перевищує певну кількість рядків
setTimeout(() => { // Використовуємо setTimeout, щоб дочекатися розрахунку висоти елемента
if (reviewText.scrollHeight > 60) { // Змінюйте значення "60" відповідно до вашого дизайну
reviewText.classList.add('shortened');
const readMoreButton = document.createElement('button');
readMoreButton.classList.add('read-more-btn');
readMoreButton.textContent = 'Читати далі';
reviewElement.appendChild(readMoreButton);

readMoreButton.addEventListener('click', function() {
reviewText.classList.toggle('expanded');
this.textContent = reviewText.classList.contains('expanded') ? 'Згорнути' : 'Читати далі';
});
}
}, 0);

reviewsContainer.appendChild(reviewElement);
});
} catch (error) {
console.error('Помилка завантаження відгуків:', error);
}
}


async function approveReview(reviewId, button) {
try {
const response = await fetch(`/api/reviews/approve/${reviewId}`, {
method: 'PATCH',
});

if (response.ok) {
alert('Відгук схвалено!');
button.textContent = 'Схвалено';
button.disabled = true; // Деактивуємо кнопку після схвалення
} else {
console.error('Помилка схвалення відгуку:', response.statusText);
}
} catch (error) {
console.error('Помилка схвалення відгуку:', error);
}
}

async function deleteReview(reviewId, button) {
try {
const response = await fetch(`/api/reviews/${reviewId}`, {
method: 'DELETE',
});

if (response.ok) {
alert('Відгук видалено!');
// Видаляємо елемент відгуку з DOM
button.parentElement.remove();
} else {
console.error('Помилка видалення відгуку:', response.statusText);
}
} catch (error) {
console.error('Помилка видалення відгуку:', error);
}
}

// Завантажуємо всі відгуки при завантаженні сторінки
document.addEventListener('DOMContentLoaded', fetchAllReviews);
3 changes: 3 additions & 0 deletions js/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ app.get('/admin', (req, res) => {
res.sendFile(path.join(__dirname, '../admin.html'));
});

app.get('/portfolio', (req, res) => {
res.sendFile(path.join(__dirname, '../portfolio.html'));
});

app.get('/reviews', (req, res) => {
res.sendFile(path.join(__dirname, '../reviews.html'));
Expand Down
1 change: 1 addition & 0 deletions node_modules/.bin/uuid 2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uuid 3

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/abort-controller/LICENSE 2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions node_modules/abort-controller/README 2.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions node_modules/abort-controller/browser 2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions node_modules/abort-controller/browser 2.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions node_modules/agent-base/LICENSE 2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 387a53c

Please sign in to comment.