fix(ui): global modal scroll locks and ci branch db seeding
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 13s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled

This commit is contained in:
2026-03-05 22:54:44 +01:00
parent 663aaefc4f
commit 761c6be80a
6 changed files with 76 additions and 6 deletions

View File

@@ -418,11 +418,32 @@ jobs:
scp .env.deploy root@alpha.mintel.me:$SITE_DIR/$ENV_FILE
scp docker-compose.yml root@alpha.mintel.me:$SITE_DIR/docker-compose.yml
APP_CONTAINER="${{ needs.prepare.outputs.project_name }}-klz-app-1"
DB_CONTAINER="${{ needs.prepare.outputs.project_name }}-klz-db-1"
# Branch Seeding Logic (Production -> Branch)
if [[ "$TARGET" == "branch" ]]; then
echo "🌱 Seeding Branch Environment from Production Database..."
ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file $ENV_FILE pull && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file $ENV_FILE up -d klz-db"
# Wait for DB to be healthy
echo "Waiting for branch database to be ready..."
sleep 10
ssh root@alpha.mintel.me "docker exec $DB_CONTAINER pg_isready -U payload" || sleep 10
# Copy Production Payload DB to Branch Payload DB & ensure media is copied
echo "📦 Syncing Production DB into Branch DB..."
ssh root@alpha.mintel.me "
docker exec klz-cablescom-klz-db-1 pg_dump -U payload -d payload --clean --if-exists | docker exec -i $DB_CONTAINER psql -U payload -d payload --quiet
rsync -a --delete /var/lib/docker/volumes/klz-cablescom_klz_media_data/_data/ /var/lib/docker/volumes/${{ needs.prepare.outputs.project_name }}_klz_media_data/_data/
"
echo "✅ Branch database and media synced successfully."
fi
# Execute remote commands — alpha is pre-logged into registry.infra.mintel.me
ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file $ENV_FILE pull && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file $ENV_FILE up -d --remove-orphans"
# Restart app to pick up clean migration state
APP_CONTAINER="${{ needs.prepare.outputs.project_name }}-klz-app-1"
ssh root@alpha.mintel.me "docker restart $APP_CONTAINER"
ssh root@alpha.mintel.me "docker system prune -f --filter 'until=24h'"

View File

@@ -57,10 +57,12 @@ export default function BrochureModal({ isOpen, onClose }: BrochureModalProps) {
document.addEventListener('keydown', handleKeyDown);
// Strict overflow lock on mobile as well
document.documentElement.style.setProperty('overflow', 'hidden', 'important');
document.body.style.setProperty('overflow', 'hidden', 'important');
return () => {
document.removeEventListener('keydown', handleKeyDown);
document.documentElement.style.overflow = '';
document.body.style.overflow = '';
};
}, [isOpen, onClose]);

View File

@@ -36,6 +36,7 @@ export default function Header() {
// Prevent scroll when mobile menu is open and handle focus trap
useEffect(() => {
if (isMobileMenuOpen) {
document.documentElement.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
// Focus trap logic
const focusableElements = mobileMenuRef.current?.querySelectorAll(
@@ -80,7 +81,8 @@ export default function Header() {
};
}
} else {
document.body.style.overflow = 'unset';
document.documentElement.style.overflow = '';
document.body.style.overflow = '';
}
}, [isMobileMenuOpen]);

View File

@@ -125,13 +125,17 @@ export default function Lightbox({ isOpen, images, initialIndex, onClose }: Ligh
};
// Lock scroll
const originalStyle = window.getComputedStyle(document.body).overflow;
document.body.style.overflow = 'hidden';
const originalBodyStyle = window.getComputedStyle(document.body).overflow;
const originalHtmlStyle = window.getComputedStyle(document.documentElement).overflow;
document.documentElement.style.setProperty('overflow', 'hidden', 'important');
document.body.style.setProperty('overflow', 'hidden', 'important');
window.addEventListener('keydown', handleKeyDown);
return () => {
document.body.style.overflow = originalStyle;
document.documentElement.style.overflow = originalHtmlStyle;
document.body.style.overflow = originalBodyStyle;
window.removeEventListener('keydown', handleKeyDown);
};
}, [isOpen, prevImage, nextImage, handleClose]);

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -0,0 +1,41 @@
import { getPayload } from 'payload';
import config from '../payload.config';
async function run() {
try {
const payload = await getPayload({ config: await config });
const user = await payload.create({
collection: 'users',
data: {
email: 'agent@mintel.me',
password: 'agentpassword123',
},
});
console.log('SUCCESS: Created AI Agent admin user', user.id);
} catch (e) {
if (
e.message?.includes('duplicate key') ||
e.code === '11000' ||
String(e).includes('already exists')
) {
console.log('User already exists, attempting to update password...', e.message);
const payload = await getPayload({ config: await config });
const users = await payload.find({
collection: 'users',
where: { email: { equals: 'agent@mintel.me' } },
});
if (users.docs.length > 0) {
await payload.update({
collection: 'users',
id: users.docs[0].id,
data: { password: 'agentpassword123' },
});
console.log('SUCCESS: Updated existing AI Agent admin user password');
}
} else {
console.error('ERROR creating user:', e);
}
}
process.exit(0);
}
run();