Compare commits
13 Commits
6cfee98a6b
...
feature/di
| Author | SHA1 | Date | |
|---|---|---|---|
| c16ab192ed | |||
| fc89944cf1 | |||
| a3b36df64e | |||
| ce1fa049d1 | |||
| f01398603d | |||
| 8a520b11d6 | |||
| 7eb9d42f97 | |||
| 52c16470e6 | |||
| ad0ef20fc2 | |||
| e68389bccc | |||
| e1dbdc539b | |||
| f0f26ad64d | |||
| ddc4cf9997 |
@@ -1,5 +1,7 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
jobs:
|
jobs:
|
||||||
deploy-job:
|
deploy-job:
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ class ScrapeWebsite extends Command
|
|||||||
$output->writeln('Update prices - DONE');
|
$output->writeln('Update prices - DONE');
|
||||||
$output->writeln('COMMAND - DONE');
|
$output->writeln('COMMAND - DONE');
|
||||||
|
|
||||||
|
file_put_contents('templates/lastscrape.html.twig', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ use Krzysiej\RyobiCrawler\Twig\AppExtension;
|
|||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||||
use Twig\Extra\Cache\CacheExtension;
|
|
||||||
use Twig\Extra\Cache\CacheRuntime;
|
|
||||||
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
||||||
|
|
||||||
class Kernel extends BaseKernel
|
class Kernel extends BaseKernel
|
||||||
|
|||||||
12
templates/footer.html.twig
Normal file
12
templates/footer.html.twig
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<div class="container">
|
||||||
|
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
|
||||||
|
<div class="col-md-4 d-flex align-items-center">
|
||||||
|
<span class="mb-md-0 text-body-secondary">© 2025 Company, Inc</span>
|
||||||
|
<a class="align-items-center text-decoration-none" data-bs-theme-value="light">☀️ Light</a>
|
||||||
|
<a class="align-items-center text-decoration-none" data-bs-theme-value="dark">🌕 Dark</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 text-end text-muted">
|
||||||
|
{{ include('lastscrape.html.twig', ignore_missing: true) }}
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
@@ -11,8 +11,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href='{{ path('app_product', {'productId': product.id}) }}'
|
<a href='{{ path('app_product', {'productId': product.id}) }}'
|
||||||
class="text-decoration-none">{{ product.name }}</a>
|
class="text-decoration-none">{{ product.name }}</a>
|
||||||
<span class="badge text-bg-light"><a href="{{ path('app_search', {'search': product.subTitle}) }}"
|
<a href="{{ path('app_search', {'search': product.subTitle}) }}"><span class="badge text-bg-secondary">{{ product.subTitle }}</span></a>
|
||||||
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
|
|
||||||
{% if product.promotions is not null and product.promotions.hasPromotion %}<a
|
{% if product.promotions is not null and product.promotions.hasPromotion %}<a
|
||||||
href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span>
|
href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span>
|
||||||
</a>{% endif %}
|
</a>{% endif %}
|
||||||
|
|||||||
@@ -48,22 +48,19 @@
|
|||||||
class="text-decoration-none">{{ product.name }}</a>
|
class="text-decoration-none">{{ product.name }}</a>
|
||||||
<br>
|
<br>
|
||||||
{% if product.stock > 0 %}
|
{% if product.stock > 0 %}
|
||||||
<span class="badge text-bg-light">stock: {{ product.stock }}</span>
|
<span class="badge text-bg-secondary">stock: {{ product.stock }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge text-bg-warning">out of stock</span>
|
<span class="badge text-bg-warning">out of stock</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if product.isDiscontinued() %}
|
{% if product.isDiscontinued() %}
|
||||||
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-toggle="tooltip"
|
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
|
||||||
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if product.isNew() %}
|
{% if product.isNew() %}
|
||||||
<a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
|
<a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="badge text-bg-light"><a
|
<a href="{{ path('app_search', {'search': product.subTitle}) }}"><span class="badge text-bg-secondary">{{ product.subTitle }}</span></a>
|
||||||
href="{{ path('app_search', {'search': product.subTitle}) }}"
|
|
||||||
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
|
|
||||||
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
|
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
|
||||||
<span class="badge text-bg-light">{{ product.country.countryName }}</span>
|
<span class="badge text-bg-secondary">{{ product.country.countryName }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
||||||
|
|||||||
@@ -1,6 +1,75 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-bs-theme="light">
|
<html lang="en" data-bs-theme="">
|
||||||
<head>
|
<head>
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const getStoredTheme = () => localStorage.getItem('theme')
|
||||||
|
const setStoredTheme = theme => localStorage.setItem('theme', theme)
|
||||||
|
|
||||||
|
const getPreferredTheme = () => {
|
||||||
|
const storedTheme = getStoredTheme()
|
||||||
|
if (storedTheme) {
|
||||||
|
return storedTheme
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTheme = theme => {
|
||||||
|
if (theme === 'auto') {
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
|
||||||
|
} else {
|
||||||
|
document.documentElement.setAttribute('data-bs-theme', theme)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTheme(getPreferredTheme())
|
||||||
|
|
||||||
|
const showActiveTheme = (theme, focus = false) => {
|
||||||
|
const themeSwitcher = document.querySelector('#bd-theme')
|
||||||
|
|
||||||
|
if (!themeSwitcher) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
|
||||||
|
|
||||||
|
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
|
||||||
|
element.classList.remove('active')
|
||||||
|
})
|
||||||
|
|
||||||
|
btnToActive.classList.add('active')
|
||||||
|
|
||||||
|
if (focus) {
|
||||||
|
themeSwitcher.focus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||||
|
const storedTheme = getStoredTheme()
|
||||||
|
if (storedTheme !== 'light' && storedTheme !== 'dark') {
|
||||||
|
setTheme(getPreferredTheme())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
showActiveTheme(getPreferredTheme())
|
||||||
|
|
||||||
|
document.querySelectorAll('[data-bs-theme-value]')
|
||||||
|
.forEach(toggle => {
|
||||||
|
toggle.addEventListener('click', () => {
|
||||||
|
const theme = toggle.getAttribute('data-bs-theme-value')
|
||||||
|
setStoredTheme(theme)
|
||||||
|
setTheme(theme)
|
||||||
|
showActiveTheme(theme, true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})()
|
||||||
|
|
||||||
|
</script>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
@@ -13,7 +82,8 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="{{ path('app_home') }}">Crawler</a>
|
<a class="navbar-brand" href="{{ path('app_home') }}">Crawler</a>
|
||||||
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||||
|
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
@@ -45,6 +115,7 @@
|
|||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
{{ include('footer.html.twig') }}
|
||||||
<script src="/templates/js/bootstrap.bundle.min.js"></script>
|
<script src="/templates/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user