BS-007 Implement accepted Contact page and independent enquiry service
@@ -28,6 +28,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
- run: python -m pip install -r config/requirements-dev.txt
|
- run: python -m pip install -r config/requirements-dev.txt
|
||||||
|
- run: pytest test_contact_independent.py
|
||||||
- run: pytest --cov --cov-report=term-missing
|
- run: pytest --cov --cov-report=term-missing
|
||||||
|
|
||||||
backend-mysql:
|
backend-mysql:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Isolated manual-test runtime only. No SWAG, production env, external networks or mail.
|
# Isolated database-free Contact runtime. No SWAG, production env or outbound mail.
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
build:
|
build:
|
||||||
@@ -8,11 +8,9 @@ services:
|
|||||||
DEBUG: 'false'
|
DEBUG: 'false'
|
||||||
APP_URL: http://127.0.0.1:18081
|
APP_URL: http://127.0.0.1:18081
|
||||||
CORS_ORIGINS: http://127.0.0.1:18081
|
CORS_ORIGINS: http://127.0.0.1:18081
|
||||||
SQLALCHEMY_DATABASE_URI: sqlite:////tmp/testtask.sqlite
|
|
||||||
EMAIL_DELIVERY_ENABLED: 'false'
|
EMAIL_DELIVERY_ENABLED: 'false'
|
||||||
REGISTRATION_MODE: closed
|
CONTACT_TRUST_PROXY: 'true'
|
||||||
SECRET_KEY: disposable-local-testtask-key-not-for-production
|
command: [gunicorn, --bind, '0.0.0.0:5000', --workers, '1', --timeout, '20', contact_app:app]
|
||||||
command: [sh, -c, 'flask --app api.py db upgrade && exec gunicorn --bind 0.0.0.0:5000 --workers 1 api:app']
|
|
||||||
tmpfs:
|
tmpfs:
|
||||||
- /tmp:mode=1777
|
- /tmp:mode=1777
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import urllib.request
|
|||||||
for url in ['http://127.0.0.1:15001/api/health/ready', 'http://127.0.0.1:18081/', 'http://127.0.0.1:18081/api/health/ready']:
|
for url in ['http://127.0.0.1:15001/api/health/ready', 'http://127.0.0.1:18081/', 'http://127.0.0.1:18081/api/health/ready']:
|
||||||
with urllib.request.urlopen(url, timeout=10) as response:
|
with urllib.request.urlopen(url, timeout=10) as response:
|
||||||
assert response.status == 200, url
|
assert response.status == 200, url
|
||||||
print('Ready: http://127.0.0.1:18081/ — inherited starter; registration closed, email disabled; no login required.')
|
print('Ready: http://127.0.0.1:18081/ — BortStack marketing; database-free Contact runtime, delivery disabled; no login required.')
|
||||||
PY
|
PY
|
||||||
;;
|
;;
|
||||||
cleanup)
|
cleanup)
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ ROBORTO_TASK_ID_PATTERN='^[0-9]{3}$'
|
|||||||
ROBORTO_WORKTREE="${ROBORTO_PROJECT_ROOT}/.test-worktrees/task-${ROBORTO_TASK_ID}"
|
ROBORTO_WORKTREE="${ROBORTO_PROJECT_ROOT}/.test-worktrees/task-${ROBORTO_TASK_ID}"
|
||||||
ROBORTO_HOOK="${ROBORTO_PROJECT_ROOT}/.roborto/testtask-hook"
|
ROBORTO_HOOK="${ROBORTO_PROJECT_ROOT}/.roborto/testtask-hook"
|
||||||
# Loopback-only manual testing; fixed ports prevent concurrent conflicting sessions.
|
# Loopback-only manual testing; fixed ports prevent concurrent conflicting sessions.
|
||||||
ROBORTO_BROWSER_URL="http://127.0.0.1:18081/about"
|
ROBORTO_BROWSER_URL="http://127.0.0.1:18081/contact"
|
||||||
ROBORTO_READY_PORTS=(15001 18081)
|
ROBORTO_READY_PORTS=(15001 18081)
|
||||||
ROBORTO_READY_LABELS=(API Web)
|
ROBORTO_READY_LABELS=(API Web)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ Report files and behaviour changed; tests added or updated; commands run; test,
|
|||||||
- Captain's newest explicit instructions govern intended changes. Code/configuration prove observed behavior; report conflicts with plans rather than treating inherited behavior as approved product scope.
|
- Captain's newest explicit instructions govern intended changes. Code/configuration prove observed behavior; report conflicts with plans rather than treating inherited behavior as approved product scope.
|
||||||
- Integration branch: `codex`. Task IDs: `BS-###`; branches: `bs-###`; isolated implementation worktrees: `.task-worktrees/bs-###` under the integration checkout. One accepted, scoped task per branch/worktree. Report path, branch, status and existing changes before edits.
|
- Integration branch: `codex`. Task IDs: `BS-###`; branches: `bs-###`; isolated implementation worktrees: `.task-worktrees/bs-###` under the integration checkout. One accepted, scoped task per branch/worktree. Report path, branch, status and existing changes before edits.
|
||||||
- No commit, push, merge, rebase, release or production deployment without explicit authorization. Green checks mean implementation-ready, not Complete. Captain review/manual acceptance and the authorized integration process are required for Complete.
|
- No commit, push, merge, rebase, release or production deployment without explicit authorization. Green checks mean implementation-ready, not Complete. Captain review/manual acceptance and the authorized integration process are required for Complete.
|
||||||
- Current accepted tasks and Captain authorizations are recorded in docs/TASKS.md and the latest handoff. On 2026-11-10 Captain accepted Services and authorized integration of its dependency stack (BS-002/003/004/011/012). BS-013 About was manually accepted by Captain on 2026-11-10 with explicit commit/merge authorization. Future commits/merges and production deployment require the applicable explicit authorization. Original CODEX_HANDOFF.md is historical input; its instruction to continue automatically is superseded.
|
- Current accepted tasks and Captain authorizations are recorded in docs/TASKS.md and the latest handoff. On 2026-11-10 Captain accepted Services and authorized integration of its dependency stack (BS-002/003/004/011/012). BS-013 About was manually accepted by Captain on 2026-11-10 with explicit commit/merge authorization. BS-007 Contact was manually accepted by Captain on 2026-11-10, followed by explicit commit-all/merge authorization. Production remains unauthorized. Future commits/merges and production deployment require the applicable explicit authorization. Original CODEX_HANDOFF.md is historical input; its instruction to continue automatically is superseded.
|
||||||
- Canonical maintained context lives in `docs/{PROJECT_OVERVIEW,CURRENT_STATE,DECISIONS,TASKS,HANDOFF}.md`; root counterparts are navigation pointers. Read all at entry and refresh after meaningful work. Original handoff text is preserved in `docs/source-handoff/`.
|
- Canonical maintained context lives in `docs/{PROJECT_OVERVIEW,CURRENT_STATE,DECISIONS,TASKS,HANDOFF}.md`; root counterparts are navigation pointers. Read all at entry and refresh after meaningful work. Original handoff text is preserved in `docs/source-handoff/`.
|
||||||
- Design authority: `brand/BORTSTACK_BRAND_DECISION.md`, authentic master artwork when supplied, `assets/references/home-approved-direction.png`, `DESIGN_SPEC.md` and approved brand tokens. Reference images are concepts, never authentic logos or project screenshots. Never invent replacement logo artwork.
|
- Design authority: `brand/BORTSTACK_BRAND_DECISION.md`, authentic master artwork when supplied, `assets/references/home-approved-direction.png`, `DESIGN_SPEC.md` and approved brand tokens. Reference images are concepts, never authentic logos or project screenshots. Never invent replacement logo artwork.
|
||||||
- Marketing website remains independent of API Admin. Inherited authentication, database, branding and deployment scaffolding are provisional; see `docs/TEMPLATE_RECONCILIATION.md`. Preserve existing behaviour outside the accepted task; do not resolve later tasks during bootstrap.
|
- Marketing website remains independent of API Admin. Inherited authentication, database, branding and deployment scaffolding are provisional; see `docs/TEMPLATE_RECONCILIATION.md`. Preserve existing behaviour outside the accepted task; do not resolve later tasks during bootstrap.
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
"""Independent, database-free BortStack enquiry service. No account imports."""
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from email.utils import parseaddr
|
||||||
|
from html import escape
|
||||||
|
from urllib.request import Request, urlopen
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from flask import Flask, request
|
||||||
|
from flask_limiter import Limiter
|
||||||
|
from flask_limiter.util import get_remote_address
|
||||||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
|
SERVICES = ('Website Development', 'Custom Software & Web Applications',
|
||||||
|
'API Development & Integration', 'Managed Hosting & Maintenance')
|
||||||
|
|
||||||
|
|
||||||
|
def valid_email(value):
|
||||||
|
return (isinstance(value, str) and len(value) <= 254
|
||||||
|
and re.fullmatch(r"[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+", value) is not None)
|
||||||
|
|
||||||
|
|
||||||
|
def deliver(payload, key, config):
|
||||||
|
"""Bounded provider call; only provider acceptance with an ID counts as success."""
|
||||||
|
req = Request('https://api.resend.com/emails', data=json.dumps(payload).encode(),
|
||||||
|
headers={'Authorization': f"Bearer {config['RESEND_API_KEY']}",
|
||||||
|
'Content-Type': 'application/json', 'Idempotency-Key': f'contact/{key}'},
|
||||||
|
method='POST')
|
||||||
|
with urlopen(req, timeout=10) as response:
|
||||||
|
result = json.loads(response.read(16384))
|
||||||
|
if not isinstance(result, dict) or not isinstance(result.get('id'), str) or not result['id']:
|
||||||
|
raise ValueError('Provider did not acknowledge acceptance')
|
||||||
|
|
||||||
|
|
||||||
|
def create_app(overrides=None):
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.config.update(MAX_CONTENT_LENGTH=32768,
|
||||||
|
CONTACT_EMAIL=os.environ.get('CONTACT_EMAIL', ''),
|
||||||
|
EMAIL_FROM=os.environ.get('EMAIL_FROM', ''),
|
||||||
|
RESEND_API_KEY=os.environ.get('RESEND_API_KEY', ''),
|
||||||
|
EMAIL_DELIVERY_ENABLED=os.environ.get('EMAIL_DELIVERY_ENABLED', 'false').lower() == 'true',
|
||||||
|
CONTACT_TRUST_PROXY=os.environ.get('CONTACT_TRUST_PROXY', 'false').lower() == 'true')
|
||||||
|
if overrides:
|
||||||
|
app.config.update(overrides)
|
||||||
|
# Enable only behind a single trusted proxy that overwrites client headers.
|
||||||
|
if app.config['CONTACT_TRUST_PROXY']:
|
||||||
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1)
|
||||||
|
limiter = Limiter(get_remote_address, app=app, storage_uri='memory://')
|
||||||
|
app.extensions['contact_limiter'] = limiter
|
||||||
|
|
||||||
|
def configured():
|
||||||
|
sender = app.config['EMAIL_FROM']
|
||||||
|
return bool(app.config['EMAIL_DELIVERY_ENABLED']
|
||||||
|
and valid_email(app.config['CONTACT_EMAIL'])
|
||||||
|
and isinstance(sender, str) and '\r' not in sender and '\n' not in sender
|
||||||
|
and valid_email(parseaddr(sender)[1]) and app.config['RESEND_API_KEY'])
|
||||||
|
|
||||||
|
@app.get('/api/health')
|
||||||
|
@app.get('/api/health/live')
|
||||||
|
@app.get('/api/health/ready')
|
||||||
|
def health():
|
||||||
|
# Process readiness is separate from externally configured mail availability.
|
||||||
|
return {'status': 'ready'}
|
||||||
|
|
||||||
|
@app.get('/api/contact/config')
|
||||||
|
def contact_config():
|
||||||
|
email = app.config['CONTACT_EMAIL']
|
||||||
|
response = app.json.response({'email': email if valid_email(email) else None,
|
||||||
|
'available': configured()})
|
||||||
|
response.headers['Cache-Control'] = 'no-store'
|
||||||
|
return response
|
||||||
|
|
||||||
|
@app.errorhandler(413)
|
||||||
|
def too_large(_error):
|
||||||
|
return {'message': 'Message is too large.'}, 413
|
||||||
|
|
||||||
|
@app.errorhandler(429)
|
||||||
|
def limited(_error):
|
||||||
|
return {'message': 'Too many attempts. Please try again later.'}, 429, {'Retry-After': '3600'}
|
||||||
|
|
||||||
|
@app.post('/api/contact')
|
||||||
|
@limiter.limit('5 per hour;20 per day')
|
||||||
|
def contact():
|
||||||
|
data = request.get_json(silent=True)
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
return {'message': 'Send a valid enquiry.'}, 400
|
||||||
|
allowed = {'name', 'email', 'service', 'description', 'website'}
|
||||||
|
if set(data) - allowed or any(not isinstance(v, str) for v in data.values()):
|
||||||
|
return {'message': 'Send a valid enquiry.'}, 400
|
||||||
|
if data.get('website', ''):
|
||||||
|
return {'message': 'Unable to accept this enquiry.'}, 400
|
||||||
|
values = {k: data.get(k, '').strip() for k in allowed}
|
||||||
|
errors = {}
|
||||||
|
if not 1 <= len(values['name']) <= 100 or any(ord(c) < 32 for c in values['name']):
|
||||||
|
errors['name'] = 'Enter your name (up to 100 characters).'
|
||||||
|
if not valid_email(values['email']):
|
||||||
|
errors['email'] = 'Enter a valid email address.'
|
||||||
|
if values['service'] and values['service'] not in SERVICES:
|
||||||
|
errors['service'] = 'Choose one of the listed services or leave it blank.'
|
||||||
|
if not 10 <= len(values['description']) <= 5000 or '\x00' in values['description']:
|
||||||
|
errors['description'] = 'Describe your project in 10 to 5,000 characters.'
|
||||||
|
if errors:
|
||||||
|
return {'message': 'Please check the highlighted fields.', 'errors': errors}, 400
|
||||||
|
key = request.headers.get('Idempotency-Key', '')
|
||||||
|
try:
|
||||||
|
if str(UUID(key)) != key:
|
||||||
|
raise ValueError()
|
||||||
|
except (ValueError, AttributeError):
|
||||||
|
return {'message': 'Refresh the page and try again.'}, 400
|
||||||
|
if not configured():
|
||||||
|
return {'message': 'Enquiries are temporarily unavailable. Your message has not been sent.'}, 503
|
||||||
|
service = values['service'] or 'General enquiry'
|
||||||
|
text = f"Name: {values['name']}\nEmail: {values['email']}\nService: {service}\n\n{values['description']}"
|
||||||
|
payload = {'from': app.config['EMAIL_FROM'], 'to': [app.config['CONTACT_EMAIL']],
|
||||||
|
'reply_to': values['email'], 'subject': f'BortStack enquiry: {service}',
|
||||||
|
'text': text, 'html': '<pre>' + escape(text) + '</pre>'}
|
||||||
|
try:
|
||||||
|
deliver(payload, key, app.config)
|
||||||
|
except Exception:
|
||||||
|
# No provider exception/body or visitor data in logs/responses.
|
||||||
|
app.logger.warning('Contact provider acceptance could not be confirmed')
|
||||||
|
return {'message': 'Sending could not be confirmed. Your draft is kept; please retry. A retry of the same draft avoids duplicate processing.'}, 503
|
||||||
|
return {'success': True, 'message': 'Your enquiry has been accepted for delivery. Thank you.'}
|
||||||
|
|
||||||
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
"""Standalone tests: no tests/conftest.py or account/database fixture required."""
|
||||||
|
import json
|
||||||
|
from uuid import uuid4
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from contact_app import create_app, deliver
|
||||||
|
|
||||||
|
VALID = dict(name='Example Person', email='person@example.com', service='',
|
||||||
|
description='A useful software project enquiry.', website='')
|
||||||
|
KEY = str(uuid4())
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def app():
|
||||||
|
return create_app(dict(TESTING=True, EMAIL_DELIVERY_ENABLED=True,
|
||||||
|
EMAIL_FROM='BortStack <verified@example.com>',
|
||||||
|
CONTACT_EMAIL='business@example.com', RESEND_API_KEY='test-only'))
|
||||||
|
|
||||||
|
|
||||||
|
def post(app, data=VALID, key=KEY):
|
||||||
|
return app.test_client().post('/api/contact', json=data, headers={'Idempotency-Key': key})
|
||||||
|
|
||||||
|
|
||||||
|
def test_independent_no_database_or_account_routes(app):
|
||||||
|
assert 'sqlalchemy' not in app.extensions
|
||||||
|
assert app.test_client().get('/api/health/ready').status_code == 200
|
||||||
|
assert app.test_client().get('/api/users').status_code == 404
|
||||||
|
assert app.test_client().get('/api/contact/config').json == {'email': 'business@example.com', 'available': True}
|
||||||
|
|
||||||
|
|
||||||
|
def test_success_safe_sender_replyto_and_escaping(app):
|
||||||
|
with patch('contact_app.deliver') as send:
|
||||||
|
r = post(app, {**VALID, 'name': '<script>Example</script>'})
|
||||||
|
assert r.status_code == 200 and r.json['success'] is True
|
||||||
|
payload, key, _ = send.call_args.args
|
||||||
|
assert payload['from'] == 'BortStack <verified@example.com>'
|
||||||
|
assert payload['reply_to'] == VALID['email']
|
||||||
|
assert payload['to'] == ['business@example.com']
|
||||||
|
assert '<script>' not in payload['html']
|
||||||
|
assert key == KEY
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('change', [dict(name=''), dict(name='x'*101), dict(name='x\r\nBcc:x@y.com'),
|
||||||
|
dict(email='a@example.com\r\nBcc:x@y.com'), dict(email='not-an-email'), dict(email='a@localhost'),
|
||||||
|
dict(description='short'), dict(description='x'*5001), dict(service='Unknown'),
|
||||||
|
dict(name=['bad']), dict(email=None), dict(company='not allowed'), dict(website='bot')])
|
||||||
|
def test_invalid_does_not_send(app, change):
|
||||||
|
with patch('contact_app.deliver') as send:
|
||||||
|
assert post(app, {**VALID, **change}).status_code == 400
|
||||||
|
send.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('data', [[], 'text', 42, None])
|
||||||
|
def test_json_shape(app, data):
|
||||||
|
assert post(app, data).status_code == 400
|
||||||
|
|
||||||
|
|
||||||
|
def test_payload_limit(app):
|
||||||
|
assert post(app, {**VALID, 'description': 'x'*40000}).status_code == 413
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('config', [dict(EMAIL_DELIVERY_ENABLED=False), dict(RESEND_API_KEY=''),
|
||||||
|
dict(EMAIL_FROM=''), dict(EMAIL_FROM='x@y.com\r\nBcc:z@y.com'), dict(CONTACT_EMAIL='invalid')])
|
||||||
|
def test_disabled_or_unconfigured_never_claims_success(app, config):
|
||||||
|
app.config.update(config)
|
||||||
|
with patch('contact_app.deliver') as send:
|
||||||
|
assert post(app).status_code == 503
|
||||||
|
assert app.test_client().get('/api/contact/config').json['available'] is False
|
||||||
|
send.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
def test_missing_key(app):
|
||||||
|
assert post(app, key='').status_code == 400
|
||||||
|
|
||||||
|
|
||||||
|
def test_provider_failure_generic_no_payload_log(app, caplog):
|
||||||
|
with patch('contact_app.deliver', side_effect=RuntimeError('private provider detail')):
|
||||||
|
r = post(app)
|
||||||
|
assert r.status_code == 503
|
||||||
|
assert 'private provider detail' not in r.text + caplog.text
|
||||||
|
assert VALID['email'] not in caplog.text
|
||||||
|
assert VALID['description'] not in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_rate_limit(app):
|
||||||
|
with patch('contact_app.deliver'):
|
||||||
|
responses = [post(app) for _ in range(6)]
|
||||||
|
assert [r.status_code for r in responses] == [200]*5 + [429]
|
||||||
|
assert responses[-1].headers['Retry-After'] == '3600'
|
||||||
|
|
||||||
|
|
||||||
|
def test_provider_contract_timeout_and_idempotency(app):
|
||||||
|
with patch('contact_app.urlopen') as url:
|
||||||
|
url.return_value.__enter__.return_value.read.return_value = b'{"id":"accepted"}'
|
||||||
|
deliver({'from':'verified@example.com'}, KEY, app.config)
|
||||||
|
req = url.call_args.args[0]
|
||||||
|
assert url.call_args.kwargs['timeout'] == 10
|
||||||
|
assert req.get_header('Idempotency-key') == 'contact/' + KEY
|
||||||
|
assert json.loads(req.data) == {'from':'verified@example.com'}
|
||||||
|
with patch('contact_app.urlopen') as url:
|
||||||
|
url.return_value.__enter__.return_value.read.return_value = b'{}'
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
deliver({}, KEY, app.config)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Contact service
|
||||||
|
|
||||||
|
BS-007 uses `api/contact_app.py:create_app`, exposed as `contact_app:app`. Start from api/ with existing requirements installed: `gunicorn --bind 127.0.0.1:5000 --workers 1 --timeout 20 contact_app:app`. Vite proxies /api to localhost:5000. The task Compose command selects this entry point explicitly. Existing api:app/account infrastructure and production Compose are unchanged provisional scaffolding; production adaptation remains BS-009, not ready for launch.
|
||||||
|
|
||||||
|
No SQLAlchemy, migrations, account routes or enquiry persistence. GET /api/contact/config returns only public email/null and delivery availability with no-store. Health/ready indicates service readiness, separate from mail configuration. POST /api/contact accepts JSON name (1–100), email (up to254), service (blank or one of four approved values), description (10–5000), and hidden website honeypot. Other keys/types rejected. 32KiB body limit. Errors are JSON: 400 fields/body, 413 oversized, 429 attempts, 503 disabled/unconfigured/provider failure; 200 success only after provider acknowledgement with ID. No enquiry content/provider error details logged.
|
||||||
|
|
||||||
|
Mail configuration is server-only: CONTACT_EMAIL = Captain-verified public inbox and recipient; EMAIL_FROM = verified Resend-domain sender; RESEND_API_KEY = secret; EMAIL_DELIVERY_ENABLED=true only when authorized/configured. Defaults are blank/disabled; no example mailbox is published. No live credentials or real sends used for this task. Configuration cannot independently prove sender/domain verification; Resend must accept the send. Do not put secrets in VITE variables. The separate inherited .env.example contains template values, not approved contact identity.
|
||||||
|
|
||||||
|
Direct Resend HTTPS call uses Python standard library, timeout10s, visitor email only as reply_to, fixed configured From/To, escaped HTML/plain text and service-derived subject. No new dependencies. Provider acknowledgement means accepted for delivery, not a guarantee of receipt. No automatic retries: draft and request key retained in the current page after failure; unchanged-draft retry uses the same UUID Idempotency-Key, edits create a fresh key. Browser timeout15s. Refresh/navigation loses unsent draft/key; no local-storage enquiry retention. Retry promptly without editing after uncertain outcome; provider idempotency expires after24h. Provider reference: https://resend.com/docs/dashboard/emails/idempotency-keys .
|
||||||
|
|
||||||
|
Limits: 5 attempts/hour and20/day per direct remote IP, including failures, held in memory per process; no rate-limit bypass from untrusted forwarding headers by default. CONTACT_TRUST_PROXY=true only behind one trusted proxy that sets/appends the real client IP and blocks direct external backend access. Task Compose enables it for local nginx; direct diagnostic port is loopback/test-only. Multiworker/multireplica global limits, production proxy/edge policy, provider data handling/privacy review and deployment authorization remain launch work. No claim of comprehensive spam prevention.
|
||||||
|
|
||||||
|
Validation: `python -m pytest test_contact_independent.py` in api/ exercises this app without account fixtures, plus existing `python -m pytest tests`. CI backend runs both. Browser success/failure are controlled responses; actual local Docker integration has delivery disabled. Manual review from project root: `./scripts/testtask.sh TASK-007`. Validate four fields, dark/light/mobile layout, empty-form errors and honest not-sent response with retained draft. Do not enter sensitive real enquiries into local test fixtures.
|
||||||
@@ -1,21 +1,27 @@
|
|||||||
# BortStack current state
|
# BortStack current state
|
||||||
|
|
||||||
Updated 2026-11-10. Captain accepted BS-013 About and explicitly authorized commit/merge into codex. This record accompanies that integration from bs-013 / .task-worktrees/bs-013, based on codex/be0dde6. No push or deployment authorized.
|
Updated 2026-11-10. Integration codex is21d048a with accepted routes/themes/homepage/Services/About. Captain accepted BS-007 Contact and authorized commit-all/merge; accepted implementation in branch bs-007 at .task-worktrees/bs-007, based on21d048a. This record accompanies authorized commit/merge into codex; no push/deployment authorized. Existing BS-014 planning changes carried into candidate; five root docs/references copies verified against canonical assets and included at Captain’s commit-all order.
|
||||||
|
|
||||||
## About implementation
|
## Contact candidate
|
||||||
|
|
||||||
/about now follows about-concept.png: business-first split introduction with two-colour heading, reserved branded laptop-art footprint, full-width divider, Why BortStack heading and three stacked Practical engineering / Clear communication / Long-term support rows, then two-line closing invitation. Contact action navigates to existing Contact placeholder; no form implied. Copy avoids invented team/credentials/achievements and keeps support agreed per project.
|
/contact now reproduces contact-concept.png: wide split hero and native layered-plane linework, bordered four-field form and right invitation/email panel. Exactly name/email/optional service/description; hidden honeypot. Company field and unverified email/location/response promises omitted. Approved palette, persistent themes and existing authentic-logo placeholder retained. Contact-only header/styles; shared footer unchanged pending BS-014.
|
||||||
|
|
||||||
Native code/chat/layers icons match the reference roles; authentic logo and standalone branded laptop art are missing and visibly labelled. No new symbol geometry, cropped reference artwork or unrelated hero illustration. Approved palette and accepted Poppins/themes retained. About-only CSS scopes header/active indicator without changing accepted pages.
|
Independent database-free Flask entry point contact_app:app exposes config/health/contact only; no accounts/migrations/SQLAlchemy. JSON/type/length/email/service validation,32KiB bound, honeypot,5/hour+20/day process-local IP limits. Safe sender/Reply-To, escaped mail,10s Resend HTTP timeout. Success requires provider acceptance ID. Disabled/unconfigured delivery returns503/not sent. Draft retained on failure, same-draft retry retains UUID provider idempotency key; no draft/message storage. See CONTACT.md for config, privacy/production limits and commands. Inherited account app and production Compose remain provisional, unchanged.
|
||||||
|
|
||||||
## Evidence and validation
|
## Validation and visual evidence
|
||||||
|
|
||||||
At reference 1024×1536: header 74px, main left 52px, hero divider y566, first icon row y685/icon113px, closing panel x30/y1176/w964/h275; page fits 1536px including understated footer. Before/after, reference comparison, 1440 desktop/768 tablet/390 mobile/320 narrow/light 1024 captures and measurements under docs/visual-qa/bs-013/. Inspected with no overflow, console/page errors or HTTP 400+ responses. Minor typography/icon/gradient differences are approximations; original missing artwork blocks full asset fidelity.
|
Lint,33 unit tests and production build passed.29 independent Contact backend tests plus14 inherited backend tests passed in disposable Docker using declared dev dependencies. Full desktop45/mobile45 browser checks passed; Contact checks cover responsive form, field count/errors, keyboard/axe in both themes, persistence, sending/disabled, provider errors/network failure, retained draft/key and acknowledgement success. Final HTML-proxy error handling is also covered by focused Contact recheck.
|
||||||
|
|
||||||
Lint, 33unit tests, Vite build and all 72Playwright browser cases passed, including About route/navigation/CTA, active nav, keyboard skip, both-theme axe/persistence, responsive heading bounds and reference anchors. Accepted homepage 1024px and Services 1672px screenshots are PNG-byte-identical. Existing routes/themes/regressions preserved.
|
Live before/after at1536×1024 plus1440/768/390/320/light1536 inspected. Form x60/y397/w913/h521 and side panel x1011/y397/w465 closely match reference; page1026px including footer. No steady-state overflow/console/page/HTTP failures. Homepage1024, Services1672 and About1024 screenshots byte-identical to accepted evidence. Files in docs/visual-qa/bs-007/. Font/linework/gradient differences and missing authentic logo remain disclosed.
|
||||||
|
|
||||||
Actual project-root TASK-013 smoke passed exact snapshot, Docker production build, disposable migrations, direct/proxied HTTP, real headless Firefox opening /about, exit 0 and owned-runtime cleanup. Snapshot refreshed after final context updates. No dependencies/manifests/lockfile/backend/production changes; backend suites not rerun. Existing 10 npm audit alerts remain recorded baseline risk.
|
Real project-root TASK-007 smoke passed snapshot/Docker build/direct+proxied readiness/real headless Firefox opening /contact, exit0; owned resources removed. Final source snapshot refreshed after documentation/error-state checks. No new dependencies/lockfile changes. Existing10 npm alerts unchanged; inherited backend datetime deprecation warnings remain. No real mail sent; provider boundary mocked in tests.
|
||||||
|
|
||||||
## Review gate
|
## Review and outstanding gates
|
||||||
|
|
||||||
BS-013 Complete for the accepted composition; Captain manual acceptance and commit/merge authorization received. Scoped pre-integration code review found no blocking defects. No Projects/Contact/Privacy or further-page work. Missing approved logo/light board/laptop media, genuine portfolio permission and actual domain/email/legal/hosting choices remain outstanding. Root pre-existing docs/references copies preserved untouched. Standard scripts interfaces unchanged.
|
BS-007 Complete for Captain-accepted composition/form behaviour, including corrected custom Service popup. Scoped pre-integration review found no blocking defects. Verified business inbox/sender/domain and Resend secret absent; real delivery unavailable until configured and separately verified. Production runtime/rate-limit proxy/storage/edge policy and provider privacy/legal review remain launch work. Logo/light board/portfolio assets remain missing. BS-014 footer design/removal of roborto.net attribution stays accepted and unengaged. No further page started.
|
||||||
|
|
||||||
|
Service dropdown review correction: native option rows now use the active BortStack theme surface/text and steel-blue selected state; selected control text uses full foreground contrast. Production build and Chromium dark/light option palette plus keyboard selection checks passed. Existing manual-test session owns the snapshot, so it was preserved; stop and restart TASK-007 to build this update.
|
||||||
|
|
||||||
|
Service popup correction after Captain screenshot: prior native-option CSS did not affect Firefox's system popup; computed CSS was insufficient visual evidence. Replaced the native Service select with a page-rendered, labelled combobox/listbox in ServiceSelect.jsx. Theme surface/border, steel-blue active row, selected check, wrapped mobile labels; pointer selection, arrows/Home/End/type-to-initial/Enter/Escape/Tab/outside dismissal, disabled sending and form reset retained. No dependency/backend changes. Actual open-popup Chromium screenshots inspected in dark/light desktop and dark mobile: service-open-chromium-*.png. 26 Contact browser tests passed (including 8 new popup/keyboard/axe/payload cases), 33 unit tests and build passed; lint/whitespace checked. Automated Firefox launch blocked by missing libdbus-glib-1.so.2 in the cached Playwright browser; no Firefox rendering pass claimed. The page-rendered list no longer uses native popup styling. Captain should restart TASK-007 to refresh the candidate; do not disturb an active test session. No commit/merge.
|
||||||
|
|
||||||
|
Integration acceptance (2026-11-10): Captain explicitly approved Contact and ordered commit all/merge. Prior manual-test snapshot notes are historical; final accepted frontend/backend match the tested source. Task runtime cleaned after acceptance; preserve worktree/history. No push/deployment or further-task implementation.
|
||||||
|
|||||||
@@ -57,3 +57,13 @@ The homepage reference controls atmosphere/layout, while written spec requires a
|
|||||||
## BS-ADR-003 — Theme and placeholder implementation (2026-11-10)
|
## BS-ADR-003 — Theme and placeholder implementation (2026-11-10)
|
||||||
|
|
||||||
Accepted scope from group engagement: dark is default independent of OS preference; visitor’s `bortstack-theme` preference is applied by a synchronous local script in head before React/styles paint. Theme continues functioning if storage is denied. Brand palette tokens copied unchanged into frontend build input; light semantic utilities are contrast adaptations, not a newly approved palette. Text-only BortStack placeholder explicitly labelled Logo pending until authentic master is supplied. No generated B symbol or project screenshot substituted.
|
Accepted scope from group engagement: dark is default independent of OS preference; visitor’s `bortstack-theme` preference is applied by a synchronous local script in head before React/styles paint. Theme continues functioning if storage is denied. Brand palette tokens copied unchanged into frontend build input; light semantic utilities are contrast adaptations, not a newly approved palette. Text-only BortStack placeholder explicitly labelled Logo pending until authentic master is supplied. No generated B symbol or project screenshot substituted.
|
||||||
|
|
||||||
|
|
||||||
|
## BS-ADR-004 — Footer business attribution (2026-11-10)
|
||||||
|
|
||||||
|
Accepted by Captain: BortStack is the development business. Remove roborto.net branding, logo and developer-site attribution from the public footer as part of BS-014 footer design. This supersedes inherited template attribution, not Roborto workflow/tooling names or the separate API Admin project-link decision. Preserve approved BortStack identity; do not invent replacement logo artwork.
|
||||||
|
|
||||||
|
|
||||||
|
## BS-ADR-005 — Independent Contact and truthful delivery (2026-11-10)
|
||||||
|
|
||||||
|
Within Captain-engaged BS-007, Contact uses a separate database-free Flask entry point (`contact_app:app`) and the existing approved Resend service. Account/template app remains provisional and unchanged. Local task runtime selects Contact explicitly, disables outbound email, and does not run migrations. Four visible fields only; hidden honeypot and process-local attempt limits. Disabled/unconfigured delivery cannot return success. Success means provider acceptance, not guaranteed inbox receipt. Provider call bounded at10s; same-draft manual retries retain an idempotency key, edits reset it; no enquiry database/local-storage draft. Verified inbox/sender/credentials and production runtime adaptation remain launch gates. Details and limitations in CONTACT.md. Footer BS-014 remains separate.
|
||||||
|
|||||||
@@ -1,25 +1,11 @@
|
|||||||
# BS-013 About accepted integration handoff
|
# BS-007 Contact accepted integration handoff
|
||||||
|
|
||||||
Replaceable supplementary snapshot, 2026-11-10. Captain engaged About after accepting/integrating Services. Candidate branch/worktree bs-013 / .task-worktrees/bs-013, based on codex/be0dde6. Captain accepted About and explicitly authorized commit/merge into codex. This handoff accompanies that integration; no push or production authorization.
|
Replaceable supplementary snapshot, 2026-11-10. Captain accepted Contact including the corrected custom Service popup and explicitly ordered commit all/merge. This record accompanies authorized integration from bs-007 / .task-worktrees/bs-007 into codex, based on21d048a. No push, deployment or next task authorized.
|
||||||
|
|
||||||
## Repeat manual testing
|
Contact reproduces the approved composition with exactly four visible fields and a styled Service combobox/listbox. Database-free Flask contact_app:app validates enquiries, applies abuse controls, preserves safe sender/Reply-To and confirms provider acceptance before success. No real mail enabled; verified inbox/sender/Resend configuration still missing. See CONTACT.md for configuration and production limits. Footer BS-014 is accepted/scoped, not implemented.
|
||||||
|
|
||||||
From project folder:
|
Validation: lint,33unit tests/build passed;29Contact+14inherited backend tests passed. Full90 desktop/mobile browser cases passed before the custom-popup correction; final26 Contact cases passed including8 new popup keyboard/axe/selection/payload checks. Actual open-popup Chromium dark/light desktop and mobile screenshots inspected; cached automated Firefox blocked by missing libdbus-glib-1.so.2, Captain subsequently accepted manual review. Earlier real TASK-007 snapshot/Docker/HTTP/real-headless-Firefox launch smoke passed; final popup source accepted manually. Before/after audit and responsive screenshots in docs/visual-qa/bs-007. Accepted homepage/Services/About screenshot regressions unchanged. No new dependencies or lockfile changes; inherited10 npm alerts remain. Pre-integration scoped code review found no blocking defects; context/whitespace validation passed.
|
||||||
|
|
||||||
```bash
|
Root BS-014 planning records preserved in authoritative tasks/decisions; five docs/references image copies byte-verified against canonical assets and included at Captain’s commit-all instruction. No secrets, generated node_modules, snapshots or runtime files included. Task-owned test runtime cleaned following acceptance; retain implementation worktrees/history. Standard repeat command from project root: ./scripts/testtask.sh TASK-007. ZIP export: ./scripts/create-chatgpt-snapshot.sh. No services launched at handoff.
|
||||||
./scripts/testtask.sh TASK-013
|
|
||||||
```
|
|
||||||
|
|
||||||
Opens http://127.0.0.1:18081/about directly in default Firefox. Keep terminal running; Ctrl-C cleans task-owned runtime. Compare with assets/references/about-concept.png: header/intro/heading proportions, artwork footprint, divider, three stacked value rows and closing panel. Check mobile menu, dark/light persistence and Get in Touch route. Contact is still a deliberate placeholder; no new form.
|
Next work remains Captain-controlled: Projects/case studies need genuine materials/permissions; Privacy/legal remains a placeholder; BS-014 footer design remains queued. Missing approved logo/artwork, verified email and production readiness remain launch gates. Stop after authorized integration.
|
||||||
|
|
||||||
Screenshot evidence: docs/visual-qa/bs-013/after-1024-full.png and reference-comparison.png; audit, before, measurements, responsive/light/regression captures included. About reference-size layout fits 1024×1536: header 74, main left 52, first row685, closing x30/y1176/w964/h275. Exact logo/laptop art missing and labelled; full asset fidelity remains gated, no artwork reconstruction. Poppins/icons/gradients approximate reference while written palette/content decisions remain authoritative. Required theme control/footer retained even where composite omits them.
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
Lint, 33unit tests, Vite production build and all 72desktop/mobile browser cases passed. Matrix 320/390/768/1024/1440 plus both themes; About coordinate checks, route/CTA, keyboard/active navigation, axe, persistence and prior page regressions covered. All review captures inspected: no overflow, console/page errors or HTTP failures. Homepage 1024 PNG and Services 1672 PNG are byte-identical to accepted captures. No shared homepage/Services/component/style edits.
|
|
||||||
|
|
||||||
Actual root TASK-013 snapshot/Docker/build/migrations/direct+proxied HTTP/real-headless-Firefox smoke reached ready opening /about, exit 0, owned cleanup verified. Final snapshot refreshed after docs. No backend or package/lockfile changes; backend suites not rerun. Existing 10 npm audit alerts unchanged. Root user docs/references copies untouched.
|
|
||||||
|
|
||||||
## Stop gate
|
|
||||||
|
|
||||||
BS-013 Complete for the accepted composition. Pre-integration review found no blocking defects and frontend hashes match the tested snapshot. Commit/merge authorized; stop after integration. Do not push, deploy or start another page without further orders. Missing original logo/light board and branded laptop art remain acknowledged asset work. Standard ZIP export: ./scripts/create-chatgpt-snapshot.sh from this worktree exports this candidate; project-root export reflects integrated codex.
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ Public routes: `/`, `/services`, `/projects`, `/projects/:slug`, `/about`, `/con
|
|||||||
|
|
||||||
Homepage follows the approved spacious dark reference: split hero, concise services, one genuine featured project, short Why BortStack section and contact CTA. Dark default, optional persistent light mode applied before first paint. Exact Concept 2 identity and approved palette are authoritative; master assets are missing.
|
Homepage follows the approved spacious dark reference: split hero, concise services, one genuine featured project, short Why BortStack section and contact CTA. Dark default, optional persistent light mode applied before first paint. Exact Concept 2 identity and approved palette are authoritative; master assets are missing.
|
||||||
|
|
||||||
Contact has exactly four visible fields: required name/email/description and optional service. Flask validates server-side, uses honeypot/rate limiting and Resend with verified sender and visitor Reply-To. Business email remains configurable and unverified. No contact database by default; failure/retry behavior still needs implementation design.
|
Contact has exactly four visible fields: required name/email/description and optional service. Flask validates server-side, uses honeypot/rate limiting and Resend with verified sender and visitor Reply-To. Business email remains configurable and unverified. BS-007 candidate supplies database-free contact_app:app, bounded provider acceptance and same-draft idempotent retries; production adaptation remains separate. See CONTACT.md.
|
||||||
|
|
||||||
## Foundation and boundaries
|
## Foundation and boundaries
|
||||||
|
|
||||||
Generated from maintained `flask-react-auth-base` using its supported generator. React/Vite/React-Bootstrap/SCSS under `react/`; Flask under `api/`; Docker Compose/nginx/SWAG scaffolding. Inherited backend code still includes SQLAlchemy, MySQL, accounts, tests and CI/deployment scaffolding; these are not approved marketing functionality. The accepted integrated frontend removes public account routes/session coupling and implements the marketing shell/themes/corrected homepage and Services, with explicit missing-asset placeholders. See TEMPLATE_RECONCILIATION.md for precise gaps and later task ownership.
|
Generated from maintained `flask-react-auth-base` using its supported generator. React/Vite/React-Bootstrap/SCSS under `react/`; Flask under `api/`; Docker Compose/nginx/SWAG scaffolding. Inherited backend code still includes SQLAlchemy, MySQL, accounts, tests and CI/deployment scaffolding; these are not approved marketing functionality. The accepted integrated frontend removes public account routes/session coupling and implements the marketing shell/themes/corrected homepage, Services and About, with explicit missing-asset placeholders. See TEMPLATE_RECONCILIATION.md for precise gaps and later task ownership.
|
||||||
|
|
||||||
Public pages should be static/prerendered for SEO; technique remains unresolved. Target deployment pattern is Compose behind SWAG with Cloudflare DNS, subject to explicit authorization and verified hosting. Domain, email identity, legal content and portfolio permissions are unresolved.
|
Public pages should be static/prerendered for SEO; technique remains unresolved. Target deployment pattern is Compose behind SWAG with Cloudflare DNS, subject to explicit authorization and verified hosting. Domain, email identity, legal content and portfolio permissions are unresolved.
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Deviation/asset gate: reference photograph replaced by restrained decorative CSS
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| BS-005 | Services and About | Services Complete under BS-012; About Complete under BS-013 |
|
| BS-005 | Services and About | Services Complete under BS-012; About Complete under BS-013 |
|
||||||
| BS-006 | Projects gallery and case studies | Real status/permissions and genuine imagery |
|
| BS-006 | Projects gallery and case studies | Real status/permissions and genuine imagery |
|
||||||
| BS-007 | Contact UI and Flask service | Exactly four fields, validation/abuse controls, delivery/failure handling; database/account decoupling |
|
| BS-007 | Contact UI and Flask service — engaged; see detailed task below | Captain manual review; verified mail configuration before real delivery |
|
||||||
| BS-008 | Privacy/legal, SEO and accessibility | Reviewed actual data flows/legal details; static/prerendered technique and metadata; wider accessibility |
|
| BS-008 | Privacy/legal, SEO and accessibility | Reviewed actual data flows/legal details; static/prerendered technique and metadata; wider accessibility |
|
||||||
| BS-009 | Docker/SWAG plan and regression tests | Adapt production database-free topology/readiness; no live cutover. Existing manual-test runtime already operational |
|
| BS-009 | Docker/SWAG plan and regression tests | Adapt production database-free topology/readiness; no live cutover. Existing manual-test runtime already operational |
|
||||||
| BS-010 | Final visual reconciliation and launch prep | Authentic brand/media, verified contact/domain and final review |
|
| BS-010 | Final visual reconciliation and launch prep | Authentic brand/media, verified contact/domain and final review |
|
||||||
@@ -115,3 +115,38 @@ Final reference anchors at 1024×1536: header 74px; main x52/w920; hero divider
|
|||||||
Validation: lint, 33unit tests, Vite production build and all 72desktop/mobile Playwright checks passed. Covers 320/390/768/1024/1440, route/CTA/active navigation, keyboard skip link, both-theme axe, preference persistence and reference-coordinate checks. Screenshot captures at 1024/1440/768/390/320/light 1024 inspected with no overflow, console/page errors or HTTP failures. Homepage 1024 and Services 1672 PNGs byte-identical to accepted captures. Actual root TASK-013 exact snapshot/Docker/build/migrations/direct+proxied HTTP/real headless Firefox smoke passed, opens /about directly, exit 0; test resources cleaned. Final snapshot refreshed after context edits.
|
Validation: lint, 33unit tests, Vite production build and all 72desktop/mobile Playwright checks passed. Covers 320/390/768/1024/1440, route/CTA/active navigation, keyboard skip link, both-theme axe, preference persistence and reference-coordinate checks. Screenshot captures at 1024/1440/768/390/320/light 1024 inspected with no overflow, console/page errors or HTTP failures. Homepage 1024 and Services 1672 PNGs byte-identical to accepted captures. Actual root TASK-013 exact snapshot/Docker/build/migrations/direct+proxied HTTP/real headless Firefox smoke passed, opens /about directly, exit 0; test resources cleaned. Final snapshot refreshed after context edits.
|
||||||
|
|
||||||
Captain screenshot/manual acceptance received on 2026-11-10 with explicit commit/merge authorization. Pre-integration code review found no blocking defects; frontend hashes match the tested snapshot. No push, production or further-page implementation authorized. Backend/package manifests/lockfile/shared component/style files unchanged; inherited dependency alerts and authentic-asset finalization remain separate recorded limitations.
|
Captain screenshot/manual acceptance received on 2026-11-10 with explicit commit/merge authorization. Pre-integration code review found no blocking defects; frontend hashes match the tested snapshot. No push, production or further-page implementation authorized. Backend/package manifests/lockfile/shared component/style files unchanged; inherited dependency alerts and authentic-asset finalization remain separate recorded limitations.
|
||||||
|
|
||||||
|
|
||||||
|
## BS-014 — Footer design and BortStack business identity
|
||||||
|
|
||||||
|
Status: Accepted/scoped by Captain on 2026-11-10; not engaged. Documentation only; implementation awaits engagement.
|
||||||
|
Objective: redesign the shared footer within the approved BortStack design, removing the inherited roborto.net developer attribution because BortStack is now the development business.
|
||||||
|
Scope: shared Footer component/styles, footer-specific configuration and tests; remove roborto.net logo, branding and developer-website link from the public footer; reconcile spacing, alignment and hierarchy with approved page references and BortStack identity. Retain useful Contact/Privacy navigation and BortStack copyright. Check existing API Admin footer-link decision separately against verified destination availability; do not silently remove or invent that destination.
|
||||||
|
Non-goals: site-wide rebranding, changing Roborto development tooling/context names, unrelated page changes, invented logo assets, new dependencies, production deployment.
|
||||||
|
Acceptance criteria:
|
||||||
|
- No roborto.net name, logo or developer-attribution link appears in the rendered footer on any public route. BortStack is the sole development-business identity in the footer.
|
||||||
|
- Footer layout matches the approved BortStack visual direction, with clear navigation and balanced desktop/mobile spacing; approved palette and persistent dark/light themes retained.
|
||||||
|
- Existing valid footer navigation works; keyboard focus and contrast remain usable; no responsive overflow or unintended page-body changes.
|
||||||
|
- Tests no longer require inherited developer branding and cover its removal. Before/after desktop and mobile screenshots supplied for Captain review.
|
||||||
|
Relevant files: react/src/components/Footer/, react/src/config/site and consumers, approved references, docs/DECISIONS.md.
|
||||||
|
Validation plan: inspect configuration consumers before removing unused footer data/assets; lint, relevant unit/regression tests, production build, browser checks on public routes at desktop/tablet/mobile and both themes; visual review and operational TASK-014 manual-test handoff.
|
||||||
|
Workflow on engagement: create bs-014 / .task-worktrees/bs-014 from integrated codex after status checks. Use project-context, scoped frontend implementation and visual QA; code review before integration. Captain acceptance and explicit commit/merge authorization required.
|
||||||
|
|
||||||
|
|
||||||
|
## BS-007 engagement — Contact implementation (2026-11-10)
|
||||||
|
|
||||||
|
Status: Complete for accepted Contact composition/form behaviour. Captain manually accepted and explicitly authorized commit-all/merge on 2026-11-10. Captain explicitly locked on and engaged Contact after BS-013. Branch bs-007 / .task-worktrees/bs-007, based on codex/21d048a. Existing BS-014 planning documentation carried forward unchanged; root docs/references copies preserved.
|
||||||
|
Objective: reproduce contact-concept.png composition with a working four-field enquiry flow independent of account/database infrastructure.
|
||||||
|
Scope: Contact route/component/SCSS; name, email, optional service and description; hidden honeypot; independent Flask contact application using existing Resend/Flask-Limiter dependencies; isolated local runtime entry point, configuration, server/browser tests and before/after evidence. Preserve existing account application outside this runtime.
|
||||||
|
Non-goals: footer design BS-014, other pages, identity redesign, new dependencies, CRM/database, production credentials, deployment, commit/merge.
|
||||||
|
Acceptance: approved 1536×1024 desktop composition and responsive 320/390/768 layouts; correct four visible fields with labels/errors/keyboard use; loading/success/failure/retry states retain draft on failure; server validates sizes/types/email/service, rate limits and honeypot; verified configured sender only, visitor Reply-To; success only after provider acceptance, disabled/unconfigured delivery reports unavailable. No enquiry bodies in logs or storage. Missing verified email remains configurable and clearly unavailable rather than fabricated.
|
||||||
|
Validation: baseline/live screenshots and iterative exact-size comparison, both themes and mobile; lint/unit/build/browser workflow/axe/regressions; Flask validation/provider/failure/abuse/configuration tests; real TASK-007 snapshot/Docker smoke with delivery disabled. Captain manual approval before Complete or integration.
|
||||||
|
Risks: verified business email/sender and Resend credentials absent; no live email verification until separately configured. In-memory limiter provides single-process bounds; production-wide storage/edge policy remains deployment scope. Real artwork masters remain absent. Reference Company/email/response promise yield to explicit written constraints.
|
||||||
|
|
||||||
|
BS-007 result: reference Contact composition implemented with four visible fields, native layered-plane illustration, honest config/email availability and accessible error/loading/success/retry states. Independent Flask app plus safe mail/abuse handling, no database/accounts. Scoped tests and screenshot evidence in docs/visual-qa/bs-007; operational TASK-007 opens /contact with delivery disabled. Lint/33unit/build passed,29Contact+14inherited backend tests passed;45desktop+45mobile browser cases passed with final focused Contact recheck. Homepage/Services/About regression PNGs byte-identical. Actual snapshot/Docker/HTTP/Firefox smoke exit0; cleanup verified. Full delivery remains gated on verified inbox/sender/Resend configuration. See CONTACT.md and CURRENT_STATE.md. Await Captain acceptance; no commit/merge/deploy. BS-014 unengaged.
|
||||||
|
|
||||||
|
Service dropdown review correction: native option rows now use the active BortStack theme surface/text and steel-blue selected state; selected control text uses full foreground contrast. Production build and Chromium dark/light option palette plus keyboard selection checks passed. Existing manual-test session owns the snapshot, so it was preserved; stop and restart TASK-007 to build this update.
|
||||||
|
|
||||||
|
Service popup correction after Captain screenshot: prior native-option CSS did not affect Firefox's system popup; computed CSS was insufficient visual evidence. Replaced the native Service select with a page-rendered, labelled combobox/listbox in ServiceSelect.jsx. Theme surface/border, steel-blue active row, selected check, wrapped mobile labels; pointer selection, arrows/Home/End/type-to-initial/Enter/Escape/Tab/outside dismissal, disabled sending and form reset retained. No dependency/backend changes. Actual open-popup Chromium screenshots inspected in dark/light desktop and dark mobile: service-open-chromium-*.png. 26 Contact browser tests passed (including 8 new popup/keyboard/axe/payload cases), 33 unit tests and build passed; lint/whitespace checked. Automated Firefox launch blocked by missing libdbus-glib-1.so.2 in the cached Playwright browser; no Firefox rendering pass claimed. The page-rendered list no longer uses native popup styling. Captain should restart TASK-007 to refresh the candidate; do not disturb an active test session. No commit/merge.
|
||||||
|
|
||||||
|
BS-007 acceptance/integration update (2026-11-10): Captain accepted the corrected custom Service popup and Contact, then ordered commit all and merge. Scoped pre-integration review found no blocking defects. This record accompanies authorized integration into codex. Previous pending-review/no-commit notes are historical and superseded by this approval; no push/deployment or next task authorized. Include queued BS-014 documentation and verified reference copies; footer implementation remains unengaged. Live email configuration/production gates remain open. Test runtime cleaned following acceptance.
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ The test-only copy lives in the task worktree’s `.test-worktrees/task-001/`, w
|
|||||||
|
|
||||||
## Runtime
|
## Runtime
|
||||||
|
|
||||||
`.roborto/testtask-compose.yml` builds solely from the snapshot, using inherited API/nginx Dockerfiles. Flask uses disposable SQLite on container tmpfs to exercise inherited foundation behavior, registration is closed and email is disabled. This is test infrastructure, not acceptance of database/accounts for the final marketing website. No account or login is required to view the starter. The selected task determines UI: BS-001 has the inherited starter; BS-004 contains the grouped marketing shell, themes and homepage candidate.
|
`.roborto/testtask-compose.yml` builds solely from the snapshot. In BS-007 and subsequent integrated checkouts, it runs the independent `contact_app:app` with one worker and no database, migrations or account routes. Outbound email is disabled; valid enquiries return 503/not sent, never simulated delivery success. UI/server success states are tested with controlled provider mocks. Browser opens `/contact` for TASK-007. Earlier retained task worktrees keep their own historical runtime configurations (including inherited SQLite). No host dependencies or command-interface changes.
|
||||||
|
|
||||||
|
|
||||||
The hook checks Docker/configuration, builds images, starts services, verifies frontend plus direct/proxied API readiness, and cleans up its own resources. One session lock per source worktree prevents conflicting snapshot refreshes. If an existing project-named container is found, it refuses to take over that environment.
|
The hook checks Docker/configuration, builds images, starts services, verifies frontend plus direct/proxied API readiness, and cleans up its own resources. One session lock per source worktree prevents conflicting snapshot refreshes. If an existing project-named container is found, it refuses to take over that environment.
|
||||||
|
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
@@ -0,0 +1,11 @@
|
|||||||
|
# BS-007 Contact visual audit
|
||||||
|
|
||||||
|
Reference: assets/references/contact-concept.png, 1536×1024. Captured current live route before edits at the same viewport.
|
||||||
|
|
||||||
|
Before: generic narrow placeholder under a 67px header; no reference split introduction, large typography, layered technical illustration, bordered form, sidebar or working enquiry. Footer inherited developer attribution remains a separate accepted BS-014 task.
|
||||||
|
|
||||||
|
Target: 88px header, left77 introduction at y143; large two-tone heading; native layered-plane illustration right; form x60/y397/w914/h521; side panel x1013/y397/w465/about447. Preserve approved palette and authentic-logo placeholder. Exactly four fields: Name, Email, optional Service, Project description; written decision overrides concept's Company. Omit unverified address/response-time claims. No phone/location claims added.
|
||||||
|
|
||||||
|
Implementation comparison: form x60/y397/w913/h521; side panel x1011/y397/w465. Heading/intro/illustration/field rhythm align closely. Header wordmark scaling is route-scoped; approved real symbol remains unavailable. Required existing footer retained pending BS-014. Fonts, native plane linework and surface gradients approximate concept using accepted Poppins and brand tokens. Unconfigured contact details explicitly unavailable rather than mocked as operational.
|
||||||
|
|
||||||
|
Final visual matrix inspected: 1536 and1440 desktop, 768 tablet, 390 mobile, 320 narrow, light1536. No overflow, console/page errors or HTTP400+ in steady-state captures. Desktop full page1026px including retained footer versus1024px reference. Form geometry remains x60/y397/w913/h521; side panel height448 after typography adjustment. Homepage1024, Services1672 and About1024 regression PNGs are byte-identical to accepted BS-013 evidence. Remaining differences: authentic logo unavailable; Poppins/native linework/gradients approximate generated details; unverified email/response/location details omitted; exact four-field decision overrides Company; footer design deferred to BS-014.
|
||||||
|
After Width: | Height: | Size: 346 KiB |
|
After Width: | Height: | Size: 405 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 348 KiB |
|
After Width: | Height: | Size: 373 KiB |
@@ -0,0 +1,104 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "after-1536-full",
|
||||||
|
"width": 1536,
|
||||||
|
"height": 1026,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1536
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "desktop-1440-full",
|
||||||
|
"width": 1440,
|
||||||
|
"height": 1026,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1440
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tablet-768-full",
|
||||||
|
"width": 768,
|
||||||
|
"height": 1353,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 768
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mobile-390-full",
|
||||||
|
"width": 390,
|
||||||
|
"height": 1696,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 390
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "narrow-320-full",
|
||||||
|
"width": 320,
|
||||||
|
"height": 1781,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 320
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "light-1536-full",
|
||||||
|
"width": 1536,
|
||||||
|
"height": 1026,
|
||||||
|
"theme": "light",
|
||||||
|
"path": "/contact",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1536
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "homepage-regression",
|
||||||
|
"width": 1024,
|
||||||
|
"height": 1557,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "services-regression",
|
||||||
|
"width": 1672,
|
||||||
|
"height": 978,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/services",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1672
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "about-regression",
|
||||||
|
"width": 1024,
|
||||||
|
"height": 1536,
|
||||||
|
"theme": "dark",
|
||||||
|
"path": "/about",
|
||||||
|
"errors": [],
|
||||||
|
"http": [],
|
||||||
|
"scrollWidth": 1024
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regression": "homepage-regression",
|
||||||
|
"byteIdentical": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regression": "services-regression",
|
||||||
|
"byteIdentical": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regression": "about-regression",
|
||||||
|
"byteIdentical": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 393 KiB |
|
After Width: | Height: | Size: 221 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 377 KiB |
|
After Width: | Height: | Size: 296 KiB |
@@ -20,7 +20,7 @@ for (const width of [320, 390, 768, 1024, 1440]) {
|
|||||||
}
|
}
|
||||||
await page.getByRole('link', { name: 'Get in Touch' }).click()
|
await page.getByRole('link', { name: 'Get in Touch' }).click()
|
||||||
await expect(page).toHaveURL(/\/contact$/)
|
await expect(page).toHaveURL(/\/contact$/)
|
||||||
await expect(page.getByRole('heading', { level: 1, name: 'Contact', exact: true })).toBeVisible()
|
await expect(page.getByRole('heading', { level: 1, name: 'Have a project in mind?', exact: true })).toBeVisible()
|
||||||
expect(errors).toEqual([])
|
expect(errors).toEqual([])
|
||||||
expect(failedRequests).toEqual([])
|
expect(failedRequests).toEqual([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
import AxeBuilder from '@axe-core/playwright'
|
||||||
|
import { expect, test } from '@playwright/test'
|
||||||
|
|
||||||
|
async function config(page, available = true) {
|
||||||
|
await page.route('**/api/contact/config', route => route.fulfill({ json: { email: 'business@example.com', available } }))
|
||||||
|
}
|
||||||
|
async function draft(page) {
|
||||||
|
await page.getByLabel('Name', { exact: true }).fill('Example Person')
|
||||||
|
await page.getByLabel('Email', { exact: true }).fill('person@example.com')
|
||||||
|
await page.getByLabel('Project description', { exact: true }).fill('A useful software project enquiry.')
|
||||||
|
}
|
||||||
|
for (const width of [320, 390, 768, 1024, 1536]) {
|
||||||
|
test(`Contact reference and form at ${width}`, async ({ page }) => {
|
||||||
|
await config(page)
|
||||||
|
await page.setViewportSize({ width, height: 1024 })
|
||||||
|
const errors = []
|
||||||
|
page.on('pageerror', e => errors.push(e.message))
|
||||||
|
await page.goto('/contact')
|
||||||
|
await page.evaluate(() => globalThis.document.fonts.ready)
|
||||||
|
await expect(page.getByRole('heading', { level: 1, name: 'Have a project in mind?' })).toBeVisible()
|
||||||
|
await expect(page.getByRole('textbox')).toHaveCount(3)
|
||||||
|
await expect(page.getByRole('combobox')).toHaveCount(1)
|
||||||
|
await expect(page.getByLabel('Company', { exact: true })).toHaveCount(0)
|
||||||
|
expect(await page.locator('html').evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
|
||||||
|
if (width === 1536) {
|
||||||
|
const box = await page.getByRole('form').boundingBox()
|
||||||
|
for (const [actual, ref] of [[box.x, 60], [box.y, 397], [box.width, 914], [box.height, 521]]) expect(Math.abs(actual - ref)).toBeLessThan(6)
|
||||||
|
}
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByLabel('Name', { exact: true })).toBeFocused()
|
||||||
|
await expect(page.getByText('Enter your name.', { exact: true })).toBeVisible()
|
||||||
|
expect(errors).toEqual([])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for (const theme of ['dark', 'light']) {
|
||||||
|
test(`Contact keyboard, errors and contrast in ${theme}`, async ({ page, isMobile }) => {
|
||||||
|
await config(page)
|
||||||
|
await page.addInitScript(theme => { if (!localStorage.getItem('bortstack-theme')) localStorage.setItem('bortstack-theme', theme) }, theme)
|
||||||
|
await page.goto('/contact')
|
||||||
|
await page.keyboard.press('Tab')
|
||||||
|
await expect(page.getByRole('link', { name: 'Skip to main content' })).toBeFocused()
|
||||||
|
await page.keyboard.press('Enter')
|
||||||
|
await expect(page.getByRole('main')).toBeFocused()
|
||||||
|
expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([])
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([])
|
||||||
|
if (isMobile) await page.getByRole('button', { name: 'Toggle navigation' }).click()
|
||||||
|
await expect(page.getByRole('navigation', { name: 'Main navigation' }).getByRole('link', { name: 'Contact', exact: true })).toHaveAttribute('aria-current', 'page')
|
||||||
|
await page.getByRole('button', { name: `Switch to ${theme === 'dark' ? 'light' : 'dark'} mode` }).click()
|
||||||
|
await page.reload()
|
||||||
|
await expect(page.locator('html')).toHaveAttribute('data-bs-theme', theme === 'dark' ? 'light' : 'dark')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
test('Contact retains failed draft and key, then succeeds without duplicate submission', async ({ page }) => {
|
||||||
|
await config(page)
|
||||||
|
const keys = [], bodies = []
|
||||||
|
let finish
|
||||||
|
await page.route('**/api/contact', async route => {
|
||||||
|
keys.push(route.request().headers()['idempotency-key'])
|
||||||
|
bodies.push(route.request().postDataJSON())
|
||||||
|
if (keys.length === 1) await route.fulfill({ status: 503, json: { message: 'Sending could not be confirmed. Please retry.' } })
|
||||||
|
else { await new Promise(resolve => { finish = resolve }); await route.fulfill({ json: { success: true } }) }
|
||||||
|
})
|
||||||
|
await page.goto('/contact')
|
||||||
|
await draft(page)
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('alert')).toContainText('could not be confirmed')
|
||||||
|
await expect(page.getByRole('alert')).toBeFocused()
|
||||||
|
await expect(page.getByLabel('Name', { exact: true })).toHaveValue('Example Person')
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('button', { name: 'Sending…' })).toBeDisabled()
|
||||||
|
await expect(page.getByLabel('Name', { exact: true })).toBeDisabled()
|
||||||
|
await expect.poll(() => keys.length).toBe(2)
|
||||||
|
finish()
|
||||||
|
await expect(page.getByRole('status')).toContainText('accepted for delivery')
|
||||||
|
expect(keys[0]).toBe(keys[1])
|
||||||
|
expect(bodies[0]).toEqual(bodies[1])
|
||||||
|
expect(Object.keys(bodies[0]).sort()).toEqual(['description', 'email', 'name', 'service', 'website'])
|
||||||
|
await expect(page.getByLabel('Name', { exact: true })).toHaveValue('')
|
||||||
|
})
|
||||||
|
test('Contact shows server errors and unavailable delivery honestly', async ({ page }) => {
|
||||||
|
await config(page, false)
|
||||||
|
await page.route('**/api/contact', r => r.fulfill({ status: 400, json: { message: 'Please check the highlighted fields.', errors: { email: 'Enter a valid email address.' } } }))
|
||||||
|
await page.goto('/contact')
|
||||||
|
await expect(page.getByText(/Enquiries are temporarily unavailable/)).toBeVisible()
|
||||||
|
await draft(page)
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('alert')).toContainText('check the highlighted fields')
|
||||||
|
await expect(page.getByLabel('Email', { exact: true })).toHaveAttribute('aria-invalid', 'true')
|
||||||
|
await page.unroute('**/api/contact')
|
||||||
|
await page.route('**/api/contact', r => r.abort())
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('alert')).toContainText('draft is kept')
|
||||||
|
await expect(page.getByText('Your enquiry has been accepted for delivery. Thank you.')).toHaveCount(0)
|
||||||
|
await page.unroute('**/api/contact')
|
||||||
|
await page.route('**/api/contact', r => r.fulfill({ status: 502, contentType: 'text/html', body: '<h1>Bad gateway</h1>' }))
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('alert')).toContainText('Unable to send right now. Your draft is kept; please retry.')
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const theme of ['dark', 'light']) {
|
||||||
|
for (const width of [320, 1536]) {
|
||||||
|
test(`Service popup is styled and keyboard accessible in ${theme} at ${width}`, async ({ page }, testInfo) => {
|
||||||
|
await config(page)
|
||||||
|
await page.setViewportSize({ width, height: 1024 })
|
||||||
|
await page.addInitScript(theme => localStorage.setItem('bortstack-theme', theme), theme)
|
||||||
|
await page.goto('/contact')
|
||||||
|
const select = page.getByRole('combobox', { name: /Service/ })
|
||||||
|
await select.click()
|
||||||
|
const list = page.getByRole('listbox', { name: /Service/ })
|
||||||
|
await expect(list).toBeVisible()
|
||||||
|
await expect(list.getByRole('option')).toHaveCount(5)
|
||||||
|
expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([])
|
||||||
|
const colors = await list.evaluate(el => ({ bg: globalThis.getComputedStyle(el).backgroundColor, text: globalThis.getComputedStyle(el).color }))
|
||||||
|
expect(colors.bg).toBe(theme === 'dark' ? 'rgb(10, 27, 42)' : 'rgb(231, 239, 245)')
|
||||||
|
expect(colors.text).toBe(theme === 'dark' ? 'rgb(245, 247, 250)' : 'rgb(16, 38, 56)')
|
||||||
|
expect(await page.locator('html').evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
|
||||||
|
await page.screenshot({ path: testInfo.outputPath(`service-open-${theme}-${width}.png`), fullPage: true })
|
||||||
|
await list.getByRole('option', { name: 'API Development & Integration' }).click()
|
||||||
|
await expect(select).toContainText('API Development & Integration')
|
||||||
|
await expect(select).toBeFocused()
|
||||||
|
await expect(list).toHaveCount(0)
|
||||||
|
await select.press('ArrowDown')
|
||||||
|
await select.press('Enter')
|
||||||
|
await expect(select).toContainText('Managed Hosting & Maintenance')
|
||||||
|
await select.press('Home')
|
||||||
|
await select.press('Escape')
|
||||||
|
await expect(select).toContainText('Managed Hosting & Maintenance')
|
||||||
|
await select.press('Home')
|
||||||
|
await select.press('Enter')
|
||||||
|
await expect(select).toContainText('Select a service')
|
||||||
|
await select.click()
|
||||||
|
await select.press('Tab')
|
||||||
|
await expect(list).toHaveCount(0)
|
||||||
|
await expect(page.getByLabel('Project description')).toBeFocused()
|
||||||
|
await select.click()
|
||||||
|
await page.getByLabel('Email', { exact: true }).click()
|
||||||
|
await expect(list).toHaveCount(0)
|
||||||
|
await draft(page)
|
||||||
|
await select.click()
|
||||||
|
await page.getByRole('option', { name: 'Website Development', exact: true }).click()
|
||||||
|
let submitted
|
||||||
|
await page.route('**/api/contact', route => { submitted = route.request().postDataJSON(); return route.fulfill({ json: { success: true } }) })
|
||||||
|
await page.getByRole('button', { name: 'Send Message' }).click()
|
||||||
|
await expect(page.getByRole('status')).toContainText('accepted for delivery')
|
||||||
|
expect(submitted.service).toBe('Website Development')
|
||||||
|
await expect(select).toContainText('Select a service')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ for (const width of [320, 768, 1440]) {
|
|||||||
}
|
}
|
||||||
await hero.getByRole('link', { name: 'Discuss a Project' }).click()
|
await hero.getByRole('link', { name: 'Discuss a Project' }).click()
|
||||||
await expect(page).toHaveURL(/\/contact$/)
|
await expect(page).toHaveURL(/\/contact$/)
|
||||||
await expect(page.getByRole('heading', { name: 'Contact', exact: true })).toBeVisible()
|
await expect(page.getByRole('heading', { name: 'Have a project in mind?', exact: true })).toBeVisible()
|
||||||
expect(errors).toEqual([])
|
expect(errors).toEqual([])
|
||||||
expect(failedRequests).toEqual([])
|
expect(failedRequests).toEqual([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { expect, test } from '@playwright/test'
|
|||||||
for (const [path, heading] of [
|
for (const [path, heading] of [
|
||||||
['/', /Software solutions\s*for real-world use\./], ['/services', 'Services'],
|
['/', /Software solutions\s*for real-world use\./], ['/services', 'Services'],
|
||||||
['/projects', 'Projects'], ['/projects/example', 'Project details'],
|
['/projects', 'Projects'], ['/projects/example', 'Project details'],
|
||||||
['/about', 'About BortStack'], ['/contact', 'Contact'], ['/privacy', 'Privacy policy'],
|
['/about', 'About BortStack'], ['/contact', 'Have a project in mind?'], ['/privacy', 'Privacy policy'],
|
||||||
['/login', 'Page not found'], ['/dashboard', 'Page not found'],
|
['/login', 'Page not found'], ['/dashboard', 'Page not found'],
|
||||||
]) {
|
]) {
|
||||||
test(`${path} renders without overflow or auth requests`, async ({ page }) => {
|
test(`${path} renders without overflow or auth requests`, async ({ page }) => {
|
||||||
const errors = []
|
const errors = []
|
||||||
const accountRequests = []
|
const accountRequests = []
|
||||||
page.on('pageerror', error => errors.push(error.message))
|
page.on('pageerror', error => errors.push(error.message))
|
||||||
page.on('request', request => { if (/\/api\//.test(request.url())) accountRequests.push(request.url()) })
|
page.on('request', request => { if (/\/api\//.test(request.url()) && !request.url().endsWith('/api/contact/config')) accountRequests.push(request.url()) })
|
||||||
await page.goto(path)
|
await page.goto(path)
|
||||||
await expect(page.getByRole('heading', { name: heading, exact: true })).toBeVisible()
|
await expect(page.getByRole('heading', { name: heading, exact: true })).toBeVisible()
|
||||||
expect(await page.locator('html').evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
|
expect(await page.locator('html').evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ for (const width of [320, 390, 768, 1024, 1672]) {
|
|||||||
}
|
}
|
||||||
await page.getByRole('link', { name: 'Get in Touch' }).click()
|
await page.getByRole('link', { name: 'Get in Touch' }).click()
|
||||||
await expect(page).toHaveURL(/\/contact$/)
|
await expect(page).toHaveURL(/\/contact$/)
|
||||||
await expect(page.getByRole('heading', { level: 1, name: 'Contact', exact: true })).toBeVisible()
|
await expect(page.getByRole('heading', { level: 1, name: 'Have a project in mind?', exact: true })).toBeVisible()
|
||||||
expect(errors).toEqual([])
|
expect(errors).toEqual([])
|
||||||
expect(failedRequests).toEqual([])
|
expect(failedRequests).toEqual([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ test('stored light initializes before React is allowed to load', async ({ page }
|
|||||||
await page.addInitScript(() => localStorage.setItem('bortstack-theme', 'light'))
|
await page.addInitScript(() => localStorage.setItem('bortstack-theme', 'light'))
|
||||||
let release
|
let release
|
||||||
const gate = new Promise(resolve => { release = resolve })
|
const gate = new Promise(resolve => { release = resolve })
|
||||||
await page.route('**/src/main.jsx', async route => { await gate; await route.continue() })
|
await page.route('**/src/main.jsx*', async route => { await gate; await route.continue() })
|
||||||
const navigation = page.goto('/')
|
const navigation = page.goto('/')
|
||||||
await page.waitForFunction(() => globalThis.document.documentElement.dataset.bsTheme === 'light')
|
await page.waitForFunction(() => globalThis.document.documentElement.dataset.bsTheme === 'light')
|
||||||
expect(await page.locator('#root').innerHTML()).toBe('')
|
expect(await page.locator('#root').innerHTML()).toBe('')
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import Homepage from "./views/Home/Homepage";
|
|||||||
import RoutePlaceholder from "./views/RoutePlaceholder";
|
import RoutePlaceholder from "./views/RoutePlaceholder";
|
||||||
import Services from "./views/Services/Services";
|
import Services from "./views/Services/Services";
|
||||||
import About from "./views/About/About";
|
import About from "./views/About/About";
|
||||||
|
import Contact from "./views/Contact/Contact";
|
||||||
|
|
||||||
const pages = [
|
const pages = [
|
||||||
["projects", "Projects", "Project details will be added after publication permissions and genuine imagery are confirmed."],
|
["projects", "Projects", "Project details will be added after publication permissions and genuine imagery are confirmed."],
|
||||||
["projects/:slug", "Project details", "This case study is not available. Only verified, approved work will be published."],
|
["projects/:slug", "Project details", "This case study is not available. Only verified, approved work will be published."],
|
||||||
["contact", "Contact", "The enquiry form and verified business email will be available here. Enquiries cannot be submitted yet."],
|
|
||||||
["privacy", "Privacy policy", "Privacy information is awaiting review against the actual website data flows before publication."],
|
["privacy", "Privacy policy", "Privacy information is awaiting review against the actual website data flows before publication."],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ export default function App() {
|
|||||||
<Route index element={<><PageMeta /><Homepage /></>} />
|
<Route index element={<><PageMeta /><Homepage /></>} />
|
||||||
<Route path="services" element={<><PageMeta title="Services" description="Website development, custom software, API integration and managed hosting from BortStack." /><Services /></>} />
|
<Route path="services" element={<><PageMeta title="Services" description="Website development, custom software, API integration and managed hosting from BortStack." /><Services /></>} />
|
||||||
<Route path="about" element={<><PageMeta title="About" description="BortStack’s approach to practical software development, clear communication and ongoing support." /><About /></>} />
|
<Route path="about" element={<><PageMeta title="About" description="BortStack’s approach to practical software development, clear communication and ongoing support." /><About /></>} />
|
||||||
|
<Route path="contact" element={<><PageMeta title="Contact" description="Discuss your software project with BortStack." /><Contact /></>} />
|
||||||
{pages.map(([path, title, description]) => (
|
{pages.map(([path, title, description]) => (
|
||||||
<Route key={path} path={path} element={<>
|
<Route key={path} path={path} element={<>
|
||||||
<PageMeta title={title} description={description} noIndex />
|
<PageMeta title={title} description={description} noIndex />
|
||||||
|
|||||||
@@ -1,82 +1,129 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Button, Form } from "react-bootstrap";
|
import { Button, Container, Form } from "react-bootstrap";
|
||||||
|
import { FiMail, FiSend } from "react-icons/fi";
|
||||||
import styles from "./Contact.module.scss";
|
import styles from "./Contact.module.scss";
|
||||||
|
|
||||||
const initialValues = {
|
import ServiceSelect from "./ServiceSelect";
|
||||||
name: "",
|
const empty = { name: "", email: "", service: "", description: "", website: "" };
|
||||||
email: "",
|
|
||||||
subject: "",
|
|
||||||
message: "",
|
|
||||||
website: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Contact() {
|
export default function Contact() {
|
||||||
const [values, setValues] = useState(initialValues);
|
const [values, setValues] = useState(empty);
|
||||||
const [status, setStatus] = useState("idle");
|
const [config, setConfig] = useState(null);
|
||||||
const [error, setError] = useState("");
|
const [errors, setErrors] = useState({});
|
||||||
|
const [status, setStatus] = useState({ kind: "idle", message: "" });
|
||||||
function update(field, value) {
|
const key = useRef(null);
|
||||||
setValues((current) => ({ ...current, [field]: value }));
|
const statusRef = useRef(null);
|
||||||
|
const formRef = useRef(null);
|
||||||
|
const sending = status.kind === "sending";
|
||||||
|
useEffect(() => {
|
||||||
|
let active = true;
|
||||||
|
fetch("/api/contact/config").then(r => {
|
||||||
|
if (!r.ok) throw new Error();
|
||||||
|
return r.json();
|
||||||
|
}).then(data => {
|
||||||
|
const email = typeof data.email === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data.email) ? data.email : null;
|
||||||
|
if (active) setConfig({ email, available: data.available === true });
|
||||||
|
}).catch(() => { if (active) setConfig({ email: null, available: false }); });
|
||||||
|
return () => { active = false; };
|
||||||
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
if (["error", "success"].includes(status.kind)) statusRef.current?.focus();
|
||||||
|
}, [status]);
|
||||||
|
function change(event) {
|
||||||
|
const { name, value } = event.target;
|
||||||
|
setValues(previous => ({ ...previous, [name]: value }));
|
||||||
|
setErrors(previous => ({ ...previous, [name]: undefined }));
|
||||||
|
key.current = null;
|
||||||
|
if (!sending) setStatus({ kind: "idle", message: "" });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit(event) {
|
async function submit(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setStatus("sending");
|
if (sending) return;
|
||||||
setError("");
|
const invalid = {};
|
||||||
|
if (!values.name.trim()) invalid.name = "Enter your name.";
|
||||||
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(values.email.trim())) invalid.email = "Enter a valid email address.";
|
||||||
|
if (values.description.trim().length < 10) invalid.description = "Describe your project in at least 10 characters.";
|
||||||
|
setErrors(invalid);
|
||||||
|
if (Object.keys(invalid).length) {
|
||||||
|
formRef.current.elements.namedItem(Object.keys(invalid)[0])?.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
key.current ??= crypto.randomUUID();
|
||||||
|
setStatus({ kind: "sending", message: "Sending your enquiry…" });
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timer = setTimeout(() => controller.abort(), 15000);
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/contact", {
|
const response = await fetch("/api/contact", {
|
||||||
method: "POST",
|
method: "POST", headers: { "Content-Type": "application/json", "Idempotency-Key": key.current },
|
||||||
headers: { "Content-Type": "application/json" },
|
body: JSON.stringify(values), signal: controller.signal,
|
||||||
body: JSON.stringify(values),
|
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
const data = await response.json().catch(() => ({}));
|
||||||
if (!response.ok) {
|
if (!response.ok || data.success !== true) {
|
||||||
throw new Error(data.message || "Unable to send message");
|
const fieldErrors = {};
|
||||||
|
for (const name of Object.keys(empty)) {
|
||||||
|
if (name !== "website" && typeof data.errors?.[name] === "string") fieldErrors[name] = data.errors[name];
|
||||||
}
|
}
|
||||||
setValues(initialValues);
|
setErrors(fieldErrors);
|
||||||
setStatus("sent");
|
throw new Error(typeof data.message === "string" ? data.message : "Unable to send right now. Your draft is kept; please retry.");
|
||||||
} catch (requestError) {
|
|
||||||
setError(requestError.message);
|
|
||||||
setStatus("error");
|
|
||||||
}
|
}
|
||||||
|
setStatus({ kind: "success", message: "Your enquiry has been accepted for delivery. Thank you." });
|
||||||
|
setValues(empty);
|
||||||
|
key.current = null;
|
||||||
|
} catch (error) {
|
||||||
|
setStatus({ kind: "error", message: error.name === "AbortError" || error instanceof TypeError
|
||||||
|
? "Sending could not be confirmed. Your draft is kept; please retry."
|
||||||
|
: error.message || "Unable to send right now. Your draft is kept; please retry." });
|
||||||
|
} finally { clearTimeout(timer); }
|
||||||
}
|
}
|
||||||
|
return <div className={styles.contactPage}>
|
||||||
return (
|
<Container>
|
||||||
<main className={styles.contact}>
|
<section className={styles.hero} aria-labelledby="contact-heading">
|
||||||
<section>
|
<div className={styles.heroCopy}>
|
||||||
<h1>Contact</h1>
|
<p className={styles.eyebrow}>Contact <span aria-hidden="true" /></p>
|
||||||
<p>Use this form to contact the application team.</p>
|
<h1 id="contact-heading">Have a <span>project</span> in mind?</h1>
|
||||||
{status === "sent" ? (
|
<p className={styles.intro}>Let’s discuss your software project, idea or requirement. <br />Send a message to start the conversation.</p>
|
||||||
<p role="status">Your message has been sent.</p>
|
|
||||||
) : (
|
|
||||||
<Form onSubmit={submit}>
|
|
||||||
<Form.Group className={styles.field} controlId="contact-name">
|
|
||||||
<Form.Label>Name</Form.Label>
|
|
||||||
<Form.Control value={values.name} maxLength={100} onChange={(event) => update("name", event.target.value)} required />
|
|
||||||
</Form.Group>
|
|
||||||
<Form.Group className={styles.field} controlId="contact-email">
|
|
||||||
<Form.Label>Email</Form.Label>
|
|
||||||
<Form.Control type="email" value={values.email} onChange={(event) => update("email", event.target.value)} required />
|
|
||||||
</Form.Group>
|
|
||||||
<Form.Group className={styles.field} controlId="contact-subject">
|
|
||||||
<Form.Label>Subject</Form.Label>
|
|
||||||
<Form.Control value={values.subject} maxLength={150} onChange={(event) => update("subject", event.target.value)} required />
|
|
||||||
</Form.Group>
|
|
||||||
<Form.Group className={styles.field} controlId="contact-message">
|
|
||||||
<Form.Label>Message</Form.Label>
|
|
||||||
<Form.Control as="textarea" rows={6} minLength={10} maxLength={5000} value={values.message} onChange={(event) => update("message", event.target.value)} required />
|
|
||||||
</Form.Group>
|
|
||||||
<div className={styles.honeypot} aria-hidden="true">
|
|
||||||
<label htmlFor="contact-website">Website</label>
|
|
||||||
<input id="contact-website" name="website" tabIndex={-1} autoComplete="off" value={values.website} onChange={(event) => update("website", event.target.value)} />
|
|
||||||
</div>
|
</div>
|
||||||
{error && <p role="alert">{error}</p>}
|
<svg className={styles.illustration} viewBox="0 0 440 260" fill="none" aria-hidden="true">
|
||||||
<Button type="submit" disabled={status === "sending"}>
|
<g stroke="currentColor" strokeWidth="1.5"><path d="m80 170 140-60 140 60-140 60Z" /><path d="m80 115 140-60 140 60-140 60Z" fill="var(--site-surface)" /><path d="M80 60 220 0 360 60 220 120Z" fill="var(--site-surface)" /></g>
|
||||||
{status === "sending" ? "Sending…" : "Send message"}
|
<g stroke="currentColor" opacity=".12"><path d="m0 140 300 120M0 180 200 80m-80 180L440 120M40 260 440 80m-80 180L40 120m160 140L0 180" /></g>
|
||||||
</Button>
|
</svg>
|
||||||
</Form>
|
|
||||||
)}
|
|
||||||
</section>
|
</section>
|
||||||
</main>
|
<div className={styles.content}>
|
||||||
);
|
<Form ref={formRef} onSubmit={submit} noValidate className={styles.form} aria-label="Project enquiry" aria-busy={sending}>
|
||||||
|
<fieldset disabled={sending}>
|
||||||
|
<legend className="visually-hidden">Tell BortStack about your project</legend>
|
||||||
|
<div className={styles.nameEmail}>
|
||||||
|
{[['name', 'Name', 'text', 100], ['email', 'Email', 'email', 254]].map(([name, label, type, max]) => <Form.Group controlId={`contact-${name}`} key={name}>
|
||||||
|
<Form.Label>{label}</Form.Label>
|
||||||
|
<Form.Control name={name} type={type} autoComplete={name} maxLength={max} required value={values[name]} onChange={change} isInvalid={!!errors[name]} aria-invalid={!!errors[name]} aria-describedby={errors[name] ? `${name}-error` : undefined} />
|
||||||
|
<Form.Control.Feedback type="invalid" id={`${name}-error`}>{errors[name]}</Form.Control.Feedback>
|
||||||
|
</Form.Group>)}
|
||||||
|
</div>
|
||||||
|
<Form.Group controlId="contact-service">
|
||||||
|
<Form.Label id="contact-service-label">Service <span>(optional)</span></Form.Label>
|
||||||
|
<ServiceSelect value={values.service} onChange={change} invalid={!!errors.service} disabled={sending} />
|
||||||
|
<Form.Control.Feedback type="invalid" id="service-error" className={errors.service ? "d-block" : undefined}>{errors.service}</Form.Control.Feedback>
|
||||||
|
</Form.Group>
|
||||||
|
<Form.Group controlId="contact-description">
|
||||||
|
<Form.Label>Project description</Form.Label>
|
||||||
|
<Form.Control as="textarea" name="description" required minLength={10} maxLength={5000} value={values.description} onChange={change} isInvalid={!!errors.description} aria-invalid={!!errors.description} aria-describedby={errors.description ? "description-error" : undefined} />
|
||||||
|
<Form.Control.Feedback type="invalid" id="description-error">{errors.description}</Form.Control.Feedback>
|
||||||
|
</Form.Group>
|
||||||
|
<div hidden aria-hidden="true"><label htmlFor="contact-website">Website</label><input id="contact-website" name="website" tabIndex={-1} autoComplete="off" value={values.website} onChange={change} /></div>
|
||||||
|
<Button type="submit" className={styles.send}><FiSend aria-hidden="true" />{sending ? "Sending…" : "Send Message"}</Button>
|
||||||
|
</fieldset>
|
||||||
|
<div ref={statusRef} tabIndex={-1} role={status.kind === "error" ? "alert" : "status"} className={styles.status} data-kind={status.kind}>{status.message}</div>
|
||||||
|
</Form>
|
||||||
|
<aside className={styles.details} aria-labelledby="contact-aside-heading">
|
||||||
|
<h2 id="contact-aside-heading">Let’s build<br />something useful.</h2>
|
||||||
|
<p>Custom software, web applications, APIs, hosting and ongoing support — practical solutions tailored to your needs.</p>
|
||||||
|
<div className={styles.email}>
|
||||||
|
<FiMail aria-hidden="true" />
|
||||||
|
{config?.email ? <a href={`mailto:${config.email}`}>{config.email}</a> : <span>{config === null ? "Loading contact details…" : "Business email will be published once verified."}</span>}
|
||||||
|
</div>
|
||||||
|
{config?.available === false && <p className={styles.availability}>Enquiries are temporarily unavailable. Messages cannot be sent right now.</p>}
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</Container>
|
||||||
|
</div>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,58 @@
|
|||||||
.contact {
|
.contactPage {
|
||||||
display: grid;
|
min-height: 890px; overflow: clip;
|
||||||
place-items: center;
|
background: radial-gradient(ellipse at 85% 22%, var(--site-glow), transparent 32%), radial-gradient(ellipse at 60% 110%, var(--site-glow), transparent 48%);
|
||||||
|
:global(.container) { width: calc(100% - 120px); max-width: 1536px; padding-inline: 0; }
|
||||||
|
}
|
||||||
|
.hero { position: relative; min-height: 309px; padding: 49px 17px 40px; }
|
||||||
|
.heroCopy { position: relative; z-index: 1; width: 76%; }
|
||||||
|
.eyebrow { display: flex; align-items: center; gap: 30px; color: var(--site-link); text-transform: uppercase; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: .17em; margin: 0 0 17px; span { width: 300px; height: 1px; background: linear-gradient(90deg, var(--site-link), transparent); } }
|
||||||
|
.hero h1 { font-size: clamp(40px, 4.3vw, 70px); line-height: 1.2; font-weight: 600; margin: 0 0 16px; letter-spacing: -.035em; span { color: var(--site-link); } }
|
||||||
|
.intro { font-size: 24px; line-height: 35px; margin: 0; }
|
||||||
|
.illustration { position: absolute; right: 0; top: 49px; width: 31%; height: 245px; color: var(--site-link); }
|
||||||
|
.content { display: grid; grid-template-columns: minmax(0, 1.965fr) minmax(0, 1fr); align-items: start; gap: 38px; padding-bottom: 58px; }
|
||||||
|
.form, .details { border: 1px solid var(--site-line); border-radius: 16px; background: linear-gradient(140deg, var(--site-glow), transparent 65%), var(--site-surface); }
|
||||||
|
.form {
|
||||||
|
padding: 34px 40px 30px;
|
||||||
|
fieldset { min-width: 0; }
|
||||||
|
:global(.form-label) { color: var(--site-text); font-size: 20px; line-height: 28px; font-weight: 600; margin-bottom: 7px; span { color: var(--site-muted); font-size: 15px; font-weight: 400; } }
|
||||||
|
:global(.form-control), :global(.form-select) { background-color: var(--site-bg); color: var(--site-text); border: 1px solid var(--bs-steel-blue); border-radius: 10px; min-height: 50px; font-size: 18px; padding: 9px 14px; &:focus { border-color: var(--site-link); box-shadow: 0 0 0 3px var(--site-glow); } }
|
||||||
|
:global(.form-select) {
|
||||||
|
color: var(--site-text);
|
||||||
|
}
|
||||||
|
:global(textarea.form-control) { min-height: 125px; resize: vertical; }
|
||||||
|
:global(.form-control.is-invalid), :global(.form-select.is-invalid) { border-color: var(--bs-danger-text-emphasis); }
|
||||||
|
:global(.invalid-feedback) { color: var(--bs-danger-text-emphasis); }
|
||||||
|
:global(.form-control:disabled) { opacity: .7; }
|
||||||
|
:global(.form-group), fieldset > div:not(.nameEmail) { margin-bottom: 15px; }
|
||||||
|
}
|
||||||
|
.nameEmail { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; margin-bottom: 18px; min-width: 0; > div { min-width: 0; } }
|
||||||
|
.send { display: inline-flex; align-items: center; gap: 18px; min-height: 60px; margin-top: 15px; padding: 10px 35px; border-radius: 11px; font-size: 22px; line-height: 34px; font-weight: 600; svg { width: 29px; height: 29px; } }
|
||||||
|
.status { margin: 0; font-size: 15px; overflow-wrap: anywhere; &:not(:empty) { margin-top: 22px; } &[data-kind="error"] { color: var(--bs-danger-text-emphasis); } }
|
||||||
|
.details { padding: 32px 36px; min-height: 448px; h2 { position: relative; font-size: 36px; line-height: 42px; font-weight: 600; margin: 0 0 22px; padding-left: 23px; &::before { content: ''; position: absolute; width: 4px; top: 6px; bottom: 6px; left: 0; background: var(--site-link); border-radius: 4px; } } > p { font-size: 19px; line-height: 31px; margin: 0 0 28px; } .availability { font-size: 14px; line-height: 23px; color: var(--site-muted); margin: 18px 0 0; } }
|
||||||
|
.email { border-top: 1px solid var(--site-line); padding-top: 28px; display: flex; gap: 22px; align-items: flex-start; font-size: 17px; line-height: 27px; overflow-wrap: anywhere; svg { color: var(--site-link); flex-shrink: 0; width: 28px; height: 28px; } a, span { min-width: 0; } }
|
||||||
|
:global(.app):has(.contactPage) :global(nav[aria-label="Main navigation"]) { min-height: 88px; &::after { left: 50px; right: 50px; } :global(.container) { max-width: 1536px; width: calc(100% - 160px); min-height: 87px; } :global(.nav-link) { font-size: 20px; padding-inline: 24px !important; } :global(.nav-link[aria-current="page"]) { position: relative; &::after { content: ''; position: absolute; left: 24px; right: 24px; bottom: 0; height: 3px; background: var(--site-link); } } }
|
||||||
|
@media (max-width: 1199.98px) { .contactPage :global(.container) { width: calc(100% - 64px); } .hero { padding-inline: 0; min-height: 290px; } .intro { font-size: 19px; line-height: 30px; } .content { gap: 24px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } .form { padding: 28px; } .nameEmail { gap: 20px; } .details { padding: 28px 24px; h2 { font-size: 27px; line-height: 36px; } > p { font-size: 16px; line-height: 27px; } } :global(.app):has(.contactPage) :global(nav[aria-label="Main navigation"]) { :global(.container) { width: calc(100% - 64px); } :global(.nav-link) { font-size: 14px; padding-inline: 12px !important; } } }
|
||||||
|
@media (max-width: 991.98px) { .content { grid-template-columns: 1fr; } .details { min-height: auto; } .heroCopy { width: 78%; } .hero h1 { font-size: 39px; } .intro { max-width: 490px; } .illustration { width: 25%; opacity: .65; top: 70px; } .eyebrow { font-size: 16px; } }
|
||||||
|
@media (max-width: 767.98px) { .contactPage { min-height: auto; :global(.container) { width: calc(100% - 40px); } } .hero { padding-top: 32px; padding-bottom: 26px; } .heroCopy { width: 100%; } .hero h1 { font-size: clamp(34px, 9vw, 48px); } .intro { font-size: 16px; line-height: 27px; br { display: none; } } .eyebrow { font-size: 14px; gap: 18px; span { max-width: 150px; } } .illustration { position: relative; display: block; width: 100%; height: 150px; top: auto; right: auto; margin-top: 20px; opacity: 1; } .form { padding: 24px 20px; :global(.form-label) { font-size: 17px; } :global(.form-control), :global(.form-select) { font-size: 16px; } } .nameEmail { grid-template-columns: 1fr; gap: 15px; } .send { width: 100%; padding-inline: 14px; font-size: 19px; gap: 12px; } .content { padding-bottom: 32px; } .details { padding: 28px 22px; h2 { font-size: 28px; line-height: 37px; } } .email { gap: 15px; font-size: 16px; } :global(.app):has(.contactPage) :global(nav[aria-label="Main navigation"]) { min-height: 67px; &::after { left: 20px; right: 20px; } :global(.container) { width: calc(100% - 40px); min-height: 43px; } :global(.nav-link) { font-size: 15px; } } }
|
||||||
|
@media (min-width: 1200px) { :global(.app):has(.contactPage) :global(a[aria-label^="BortStack home"]) > span:last-child { font-size: 40px; } }
|
||||||
|
|
||||||
section {
|
.serviceSelect { position: relative; }
|
||||||
width: min(100%, 36rem);
|
.form .serviceTrigger {
|
||||||
|
display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; background-image: none;
|
||||||
|
span { min-width: 0; overflow-wrap: anywhere; } svg { flex-shrink: 0; width: 18px; height: 18px; }
|
||||||
|
&:disabled { opacity: .7; }
|
||||||
}
|
}
|
||||||
|
.serviceOptions {
|
||||||
|
position: absolute; z-index: 30; top: calc(100% + 7px); left: 0; right: 0;
|
||||||
|
max-height: min(320px, 45vh); overflow-y: auto; padding: 6px;
|
||||||
|
background: var(--site-surface); color: var(--site-text); border: 1px solid var(--bs-steel-blue); border-radius: 10px;
|
||||||
|
box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
|
||||||
}
|
}
|
||||||
|
.serviceOption {
|
||||||
.field {
|
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
||||||
margin-bottom: 1rem;
|
padding: 11px 13px; min-height: 44px; border-radius: 6px; font-size: 16px; line-height: 24px; cursor: pointer;
|
||||||
}
|
span { min-width: 0; overflow-wrap: anywhere; } svg { flex-shrink: 0; color: var(--site-link); }
|
||||||
|
&[aria-selected="true"] { font-weight: 600; }
|
||||||
.honeypot {
|
&[data-active="true"] { background: var(--bs-steel-blue); color: #F5F7FA; svg { color: #F5F7FA; } }
|
||||||
position: absolute;
|
|
||||||
left: -10000px;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
@media (max-width: 767.98px) { .serviceOption { font-size: 14px; padding: 10px; } }
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { FiCheck, FiChevronDown } from "react-icons/fi";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
import styles from "./Contact.module.scss";
|
||||||
|
|
||||||
|
const options = ["", "Website Development", "Custom Software & Web Applications", "API Development & Integration", "Managed Hosting & Maintenance"];
|
||||||
|
const label = value => value || "Select a service";
|
||||||
|
|
||||||
|
export default function ServiceSelect({ value, onChange, invalid, disabled }) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const [active, setActive] = useState(0);
|
||||||
|
const root = useRef(null);
|
||||||
|
const button = useRef(null);
|
||||||
|
const selected = Math.max(0, options.indexOf(value));
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
const close = event => { if (!root.current?.contains(event.target)) setOpen(false); };
|
||||||
|
document.addEventListener("pointerdown", close);
|
||||||
|
return () => document.removeEventListener("pointerdown", close);
|
||||||
|
}, [open]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (open) root.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({ block: "nearest" });
|
||||||
|
}, [active, open]);
|
||||||
|
function choose(index) {
|
||||||
|
onChange({ target: { name: "service", value: options[index] } });
|
||||||
|
setOpen(false);
|
||||||
|
button.current?.focus();
|
||||||
|
}
|
||||||
|
function keyDown(event) {
|
||||||
|
const key = event.key;
|
||||||
|
if (["ArrowDown", "ArrowUp", "Home", "End", "Enter", " ", "Escape"].includes(key)) event.preventDefault();
|
||||||
|
if (key === "Escape" || key === "Tab") { setOpen(false); return; }
|
||||||
|
if (key === "Enter" || key === " ") {
|
||||||
|
if (open) choose(active);
|
||||||
|
else { setActive(selected); setOpen(true); }
|
||||||
|
} else if (["ArrowDown", "ArrowUp", "Home", "End"].includes(key)) {
|
||||||
|
const base = open ? active : selected;
|
||||||
|
setActive(key === "Home" ? 0 : key === "End" ? options.length - 1 : (base + (key === "ArrowDown" ? 1 : -1) + options.length) % options.length);
|
||||||
|
setOpen(true);
|
||||||
|
} else if (key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
||||||
|
const match = options.findIndex(option => label(option).toLowerCase().startsWith(key.toLowerCase()));
|
||||||
|
if (match >= 0) { event.preventDefault(); setActive(match); setOpen(true); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return <div ref={root} className={styles.serviceSelect} onBlur={event => { if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false); }}>
|
||||||
|
<input type="hidden" name="service" value={value} />
|
||||||
|
<button ref={button} id="contact-service" type="button" role="combobox" aria-labelledby="contact-service-label" aria-haspopup="listbox" aria-expanded={open && !disabled} aria-controls={open && !disabled ? "contact-service-options" : undefined} aria-activedescendant={open && !disabled ? `service-option-${active}` : undefined} aria-invalid={invalid} aria-describedby={invalid ? "service-error" : undefined} disabled={disabled} className={`${styles.serviceTrigger} form-select ${invalid ? 'is-invalid' : ''}`} onKeyDown={keyDown} onClick={() => { setActive(selected); setOpen(!open); }}>
|
||||||
|
<span>{label(value)}</span><FiChevronDown aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
{open && !disabled && <div id="contact-service-options" role="listbox" aria-labelledby="contact-service-label" className={styles.serviceOptions}>
|
||||||
|
{options.map((option, index) => <div id={`service-option-${index}`} key={option} role="option" aria-selected={selected === index} data-active={active === index} className={styles.serviceOption} onPointerMove={() => setActive(index)} onMouseDown={event => event.preventDefault()} onClick={() => choose(index)}>
|
||||||
|
<span>{label(option)}</span>{selected === index && <FiCheck aria-hidden="true" />}
|
||||||
|
</div>)}
|
||||||
|
</div>}
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
ServiceSelect.propTypes = { value: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, invalid: PropTypes.bool, disabled: PropTypes.bool };
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { fireEvent, render, screen, within } from "@testing-library/react";
|
import { fireEvent, render, screen, within, waitFor } from "@testing-library/react";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import App from "../App";
|
import App from "../App";
|
||||||
|
|
||||||
@@ -7,15 +7,19 @@ describe("public marketing routes", () => {
|
|||||||
it.each([
|
it.each([
|
||||||
["/services", "Services"], ["/projects", "Projects"],
|
["/services", "Services"], ["/projects", "Projects"],
|
||||||
["/projects/example", "Project details"], ["/about", "About BortStack"],
|
["/projects/example", "Project details"], ["/about", "About BortStack"],
|
||||||
["/contact", "Contact"], ["/privacy", "Privacy policy"],
|
["/contact", "Have a project in mind?"], ["/privacy", "Privacy policy"],
|
||||||
["/login", "Page not found"], ["/register", "Page not found"], ["/dashboard", "Page not found"],
|
["/login", "Page not found"], ["/register", "Page not found"], ["/dashboard", "Page not found"],
|
||||||
])("loads %s without account infrastructure", (path, heading) => {
|
])("loads %s without account infrastructure", async (path, heading) => {
|
||||||
const fetchMock = vi.fn();
|
const fetchMock = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ email: null, available: false }) });
|
||||||
vi.stubGlobal("fetch", fetchMock);
|
vi.stubGlobal("fetch", fetchMock);
|
||||||
window.history.replaceState({}, "", path);
|
window.history.replaceState({}, "", path);
|
||||||
render(<App />);
|
render(<App />);
|
||||||
expect(screen.getByRole("heading", { level: 1, name: heading })).toBeInTheDocument();
|
expect(screen.getByRole("heading", { level: 1, name: heading })).toBeInTheDocument();
|
||||||
expect(fetchMock).not.toHaveBeenCalled();
|
if (path === "/contact") {
|
||||||
|
expect(fetchMock).toHaveBeenCalledWith("/api/contact/config");
|
||||||
|
await waitFor(() => expect(screen.getByText(/Enquiries are temporarily unavailable/)).toBeInTheDocument());
|
||||||
|
}
|
||||||
|
else expect(fetchMock).not.toHaveBeenCalled();
|
||||||
expect(screen.queryByRole("link", { name: /login|register|dashboard/i })).not.toBeInTheDocument();
|
expect(screen.queryByRole("link", { name: /login|register|dashboard/i })).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
it("exposes the four marketing links and closes navigation on selection", async () => {
|
it("exposes the four marketing links and closes navigation on selection", async () => {
|
||||||
|
|||||||
@@ -31,11 +31,10 @@ describe("generic public pages", () => {
|
|||||||
|
|
||||||
fireEvent.change(screen.getByLabelText("Name"), { target: { value: "Example Person" } });
|
fireEvent.change(screen.getByLabelText("Name"), { target: { value: "Example Person" } });
|
||||||
fireEvent.change(screen.getByLabelText("Email"), { target: { value: "person@example.com" } });
|
fireEvent.change(screen.getByLabelText("Email"), { target: { value: "person@example.com" } });
|
||||||
fireEvent.change(screen.getByLabelText("Subject"), { target: { value: "A question" } });
|
fireEvent.change(screen.getByLabelText("Project description"), { target: { value: "A message long enough to send." } });
|
||||||
fireEvent.change(screen.getByLabelText("Message"), { target: { value: "A message long enough to send." } });
|
fireEvent.click(screen.getByRole("button", { name: "Send Message" }));
|
||||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
|
||||||
|
|
||||||
await waitFor(() => expect(screen.getByRole("status")).toHaveTextContent("message has been sent"));
|
await waitFor(() => expect(screen.getByRole("status")).toHaveTextContent("accepted for delivery"));
|
||||||
expect(fetchMock).toHaveBeenCalledWith("/api/contact", expect.objectContaining({ method: "POST" }));
|
expect(fetchMock).toHaveBeenCalledWith("/api/contact", expect.objectContaining({ method: "POST" }));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -48,11 +47,10 @@ describe("generic public pages", () => {
|
|||||||
|
|
||||||
fireEvent.change(screen.getByLabelText("Name"), { target: { value: "Example Person" } });
|
fireEvent.change(screen.getByLabelText("Name"), { target: { value: "Example Person" } });
|
||||||
fireEvent.change(screen.getByLabelText("Email"), { target: { value: "person@example.com" } });
|
fireEvent.change(screen.getByLabelText("Email"), { target: { value: "person@example.com" } });
|
||||||
fireEvent.change(screen.getByLabelText("Subject"), { target: { value: "A question" } });
|
fireEvent.change(screen.getByLabelText("Project description"), { target: { value: "A message long enough to send." } });
|
||||||
fireEvent.change(screen.getByLabelText("Message"), { target: { value: "A message long enough to send." } });
|
fireEvent.click(screen.getByRole("button", { name: "Send Message" }));
|
||||||
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
|
|
||||||
|
|
||||||
await waitFor(() => expect(screen.getByRole("alert")).toHaveTextContent("Unable to send message right now"));
|
await waitFor(() => expect(screen.getByRole("alert")).toHaveTextContent("Unable to send message right now"));
|
||||||
expect(screen.getByRole("button", { name: "Send message" })).toBeEnabled();
|
expect(screen.getByRole("button", { name: "Send Message" })).toBeEnabled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||