kite-menu
This commit is contained in:
+12
-3
@@ -101,7 +101,7 @@ export default function MenuClient({ initialCategories, siteSettings }: { initia
|
||||
|
||||
{/* Logo */}
|
||||
<img
|
||||
src="/logo.png"
|
||||
src="/logo.avif"
|
||||
alt="Moy Beach"
|
||||
className="w-64 md:w-80 object-contain drop-shadow-lg"
|
||||
style={{ filter: 'brightness(0) invert(1)' }}
|
||||
@@ -194,7 +194,7 @@ export default function MenuClient({ initialCategories, siteSettings }: { initia
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
{/* Footer Logo */}
|
||||
<img
|
||||
src="/logo.png"
|
||||
src="/logo.avif"
|
||||
alt="Moy Beach"
|
||||
className="w-36 object-contain opacity-70 mb-2"
|
||||
style={{ filter: 'brightness(0) invert(1)' }}
|
||||
@@ -217,8 +217,17 @@ export default function MenuClient({ initialCategories, siteSettings }: { initia
|
||||
className="text-[11px] font-sans"
|
||||
style={{ color: "rgba(120,90,60,0.5)" }}
|
||||
>
|
||||
© 2026 Moy Beach. Tüm hakları saklıdır.
|
||||
© 2026 KiteBeach Akyaka. Tüm hakları saklıdır.
|
||||
</p>
|
||||
<a
|
||||
href="https://ayris.tech"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-[10px] font-sans mt-3 tracking-wide hover:opacity-80 transition-opacity"
|
||||
style={{ color: "rgba(120,90,60,0.7)" }}
|
||||
>
|
||||
Created by ayris.tech
|
||||
</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html lang="tr" className={`${cormorant.variable} ${jakarta.variable} h-full`}>
|
||||
<body className="min-h-full flex flex-col antialiased">{children}</body>
|
||||
<body className="min-h-full flex flex-col antialiased" suppressHydrationWarning>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import pkg from 'pg';
|
||||
import dotenv from 'dotenv';
|
||||
import bcrypt from 'bcryptjs';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const { Client } = pkg;
|
||||
|
||||
async function main() {
|
||||
const client = new Client({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
await client.connect();
|
||||
|
||||
const username = 'admin';
|
||||
const plainPassword = 'password123';
|
||||
const passwordHash = await bcrypt.hash(plainPassword, 10);
|
||||
|
||||
try {
|
||||
// Delete existing admin if any
|
||||
await client.query('DELETE FROM "users" WHERE "username" = $1', [username]);
|
||||
|
||||
await client.query(`
|
||||
INSERT INTO "users" ("username", "password_hash", "role")
|
||||
VALUES ($1, $2, $3)
|
||||
`, [username, passwordHash, 'admin']);
|
||||
|
||||
console.log(`Successfully created admin user: ${username} / ${plainPassword}`);
|
||||
} catch (e) {
|
||||
console.error('Error creating admin:', e.message);
|
||||
} finally {
|
||||
await client.end();
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
import pkg from 'pg';
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
const { Client } = pkg;
|
||||
|
||||
async function main() {
|
||||
const client = new Client({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
await client.connect();
|
||||
|
||||
const mockImageUrl = '/default-product.png';
|
||||
|
||||
try {
|
||||
const result = await client.query(`
|
||||
UPDATE "products"
|
||||
SET "image_url" = $1
|
||||
`, [mockImageUrl]);
|
||||
|
||||
console.log(`Successfully updated ${result.rowCount} products with a mock image.`);
|
||||
} catch (e) {
|
||||
console.error('Error updating products:', e.message);
|
||||
} finally {
|
||||
await client.end();
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,82 @@
|
||||
import fs from 'fs';
|
||||
import pkg from 'pg';
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
const { Client } = pkg;
|
||||
|
||||
async function main() {
|
||||
const client = new Client({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
await client.connect();
|
||||
|
||||
// Disable triggers to bypass foreign key checks temporarily
|
||||
await client.query("SET session_replication_role = replica;");
|
||||
|
||||
const sql = fs.readFileSync('./sql/kitebeac_menu.sql', 'utf8');
|
||||
|
||||
const lines = sql.split('\n');
|
||||
let currentInsert = '';
|
||||
let inInsert = false;
|
||||
let tableName = '';
|
||||
|
||||
try {
|
||||
await client.query(`TRUNCATE TABLE "products", "categories", "users", "settings" RESTART IDENTITY CASCADE;`);
|
||||
console.log('Truncated existing tables');
|
||||
} catch (e) {
|
||||
console.log('Truncate skipped or failed (possibly tables empty)', e.message);
|
||||
}
|
||||
|
||||
for (let line of lines) {
|
||||
if (line.startsWith('INSERT INTO')) {
|
||||
inInsert = true;
|
||||
currentInsert = line;
|
||||
let match = line.match(/INSERT INTO `(\w+)`/);
|
||||
if (match) {
|
||||
tableName = match[1];
|
||||
}
|
||||
} else if (inInsert) {
|
||||
currentInsert += '\n' + line;
|
||||
}
|
||||
|
||||
if (inInsert && currentInsert.trim().endsWith(';')) {
|
||||
if (['categories', 'products', 'users', 'settings'].includes(tableName)) {
|
||||
let firstLineEnd = currentInsert.indexOf('VALUES') + 6;
|
||||
let prefix = currentInsert.substring(0, firstLineEnd).replace(/`/g, '"');
|
||||
let values = currentInsert.substring(firstLineEnd);
|
||||
|
||||
values = values.replace(/\\'/g, "''");
|
||||
values = values.replace(/\\"/g, '"');
|
||||
|
||||
if (tableName === 'users') {
|
||||
prefix = prefix.replace('"password"', '"password_hash"').replace('"email"', '"username"');
|
||||
}
|
||||
|
||||
let query = prefix + values;
|
||||
|
||||
// Skip settings because of id column mismatch, not crucial for menu data
|
||||
if (tableName !== 'settings') {
|
||||
try {
|
||||
await client.query(query);
|
||||
console.log(`Successfully inserted data into "${tableName}"`);
|
||||
} catch (e) {
|
||||
console.error(`Error inserting into "${tableName}":`, e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
inInsert = false;
|
||||
currentInsert = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Re-enable triggers
|
||||
await client.query("SET session_replication_role = origin;");
|
||||
|
||||
await client.end();
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user