diff --git a/app/MenuClient.tsx b/app/MenuClient.tsx index 1bdcfbe..284151b 100644 --- a/app/MenuClient.tsx +++ b/app/MenuClient.tsx @@ -80,7 +80,7 @@ export default function MenuClient({ initialCategories, siteSettings }: { initia backgroundPosition: "center" }} /> - + {/* Dark overlay to make text readable */}
@@ -101,7 +101,7 @@ export default function MenuClient({ initialCategories, siteSettings }: { initia {/* Logo */} Moy Beach {/* Footer Logo */} Moy Beach - © 2026 Moy Beach. Tüm hakları saklıdır. + © 2026 KiteBeach Akyaka. Tüm hakları saklıdır.

+ + Created by ayris.tech +
diff --git a/app/layout.tsx b/app/layout.tsx index 23ec8f0..e9bb9c4 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -29,7 +29,7 @@ export default function RootLayout({ }>) { return ( - {children} + {children} ); } diff --git a/create_admin.mjs b/create_admin.mjs new file mode 100644 index 0000000..b5c3e93 --- /dev/null +++ b/create_admin.mjs @@ -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); +}); diff --git a/mock_images.mjs b/mock_images.mjs new file mode 100644 index 0000000..6ed1d79 --- /dev/null +++ b/mock_images.mjs @@ -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); +}); diff --git a/public/logo.avif b/public/logo.avif new file mode 100644 index 0000000..a19a885 Binary files /dev/null and b/public/logo.avif differ diff --git a/seed_from_sql.mjs b/seed_from_sql.mjs new file mode 100644 index 0000000..7ed4bfa --- /dev/null +++ b/seed_from_sql.mjs @@ -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); +});