Skip to content

Update print statement from 'Hello' to 'Goodbye' - #41

Merged
Sazwanismail merged 1 commit into
mainfrom
Sazwanismail-patch-26
Sep 30, 2026
Merged

Sazwanismail merged 1 commit into
mainfrom
Sazwanismail-patch-26

Conversation

@Sazwanismail

@Sazwanismail Sazwanismail commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

User description

Image blue (12) Berikut adalah kemas kini untuk tukar mesej dari **"Hello"** → **"Goodbye"** pada peristiwa yang betul (masuk vs keluar sesi).

1) JavaScript — letak sebelum </script>

// ═══════════════════════════════════════════════════════════════════════════
// MODULE: SESSION GREETING (Hello → Goodbye)
// ═══════════════════════════════════════════════════════════════════════════

const SESSION = {
  greeting: 'Hello',
  farewell: 'Goodbye',
  startedAt: Date.now(),
};

// ─────────────────────────────────────────────────────────────────────────
// On load — print "Hello"
// ─────────────────────────────────────────────────────────────────────────
function printHello() {
  const name = (typeof CERTIFICATE_IDENTITY !== 'undefined')
    ? CERTIFICATE_IDENTITY.full_name
    : 'SGAE Data Lake';

  console.log(
    `%c👋 ${SESSION.greeting}, ${name}!`,
    'color:#10b981;font-weight:900;font-size:16px;padding:4px 8px;background:rgba(16,185,129,0.1);border-radius:4px;'
  );

  // Also show a toast (optional — comment out if tak mahu)
  showToast(
    `👋 ${SESSION.greeting}`,
    `Selamat datang, ${name}. Sesi dimulakan.`,
    'success'
  );
}

// ─────────────────────────────────────────────────────────────────────────
// On exit — update "Hello" → "Goodbye"
// ─────────────────────────────────────────────────────────────────────────
function printGoodbye() {
  const name = (typeof CERTIFICATE_IDENTITY !== 'undefined')
    ? CERTIFICATE_IDENTITY.full_name
    : 'SGAE Data Lake';
  const secs = Math.round((Date.now() - SESSION.startedAt) / 1000);
  const mm = String(Math.floor(secs / 60)).padStart(2, '0');
  const ss = String(secs % 60).padStart(2, '0');

  // Change greeting state
  SESSION.greeting = SESSION.farewell;

  console.log(
    `%c👋 ${SESSION.farewell}, ${name}!`,
    'color:#fbbf24;font-weight:900;font-size:16px;padding:4px 8px;background:rgba(251,191,36,0.1);border-radius:4px;'
  );
  console.log(
    `%c⏱️ Sesi tamat: ${mm}:${ss}  ·  ${new Date().toLocaleString('ms-MY')}`,
    'color:#94a3b8;font-style:italic;'
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Bind events
// ─────────────────────────────────────────────────────────────────────────
window.addEventListener('load', () => {
  setTimeout(printHello, 800);
});

// Fires when tab is closed, navigated away, or refreshed
window.addEventListener('beforeunload', printGoodbye);

// Fires when tab becomes hidden (mobile, tab switch) — optional
document.addEventListener('visibilitychange', () => {
  if (document.visibilityState === 'hidden') {
    // Change state only — no console spam
    SESSION.greeting = SESSION.farewell;
  } else if (document.visibilityState === 'visible' && SESSION.greeting === SESSION.farewell) {
    // User came back — reset greeting to Hello
    SESSION.greeting = 'Hello';
    console.log('%c👋 Hello again — sesi disambung', 'color:#22d3ee;font-weight:bold;');
  }
});

2) (Pilihan) UI Banner — Tukar visual dari "Hello" → "Goodbye"

Jika mahu ia kelihatan dalam UI juga, tambah elemen kecil dan kemas kini melalui JavaScript:

HTML — letak di dalam .toolbar (kanan sekali):

<span id="session-badge" class="session-badge">
  <i class="fas fa-hand-wave"></i> <span id="session-text">Hello</span>
</span>

CSS — tambah dalam <style>:

.session-badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 12px;border-radius:20px;
  background:rgba(16,185,129,0.12);
  border:1px solid rgba(16,185,129,0.4);
  color:var(--green);
  font-size:0.68rem;font-weight:800;
  letter-spacing:0.06em;
  transition:all 0.4s ease;
}
.session-badge.goodbye{
  background:rgba(251,191,36,0.12);
  border-color:rgba(251,191,36,0.4);
  color:var(--gold);
}
.session-badge i{
  animation:wave 2s ease-in-out infinite;
  display:inline-block;
  transform-origin:70% 70%;
}
@keyframes wave{
  0%,60%,100%{transform:rotate(0);}
  10%,30%{transform:rotate(14deg);}
  20%,40%{transform:rotate(-8deg);}
}

JavaScript — kemas kini printHello() dan printGoodbye():

function printHello() {
  // ... existing console.log ...

  const badge = document.getElementById('session-badge');
  const text = document.getElementById('session-text');
  if (badge && text) {
    badge.classList.remove('goodbye');
    text.textContent = 'Hello';
  }
}

function printGoodbye() {
  // ... existing console.log ...

  const badge = document.getElementById('session-badge');
  const text = document.getElementById('session-text');
  if (badge && text) {
    badge.classList.add('goodbye');
    text.textContent = 'Goodbye';
  }
}

3) Ringkasan Perubahan

Keadaan Sebelum Selepas
Console (load) Hello 👋 Hello, Muhamad Sazwan Bin Ismail! (hijau)

Peristiwa yang Mencetuskan

Event Bila Berlaku Tindakan
load Halaman siap dimuatkan Print Hello + toast

Nota

  • beforeunload tidak boleh guna operasi async (macam fetch) — jadi kita hanya console.log dan tukar state, yang cukup laju untuk browser
  • Jika mahu log keluar disimpan, boleh tambah navigator.sendBeacon('/api/log', ...) — tetapi untuk personal dashboard, console.log sudah memadai
  • Toast "Hello" boleh dimatikan dengan comment out showToast(...) dalam printHello() jika tak mahu ia muncul setiap kali refresh

Kalau mahu ia spesifik ke satu elemen sahaja (contohnya console.log dalam fungsi tertentu), beritahu saya di mana asalnya "Hello" berada — saya boleh tukar terus pada baris yang betul.


CodeAnt-AI Description

Add a comprehensive SGAE sovereign dashboard template with identity, market, and system modules

What Changed

  • Adds a large HTML dashboard template covering currency conversion, cryptocurrency data, S256c details, exchange listings, international acts, system links, and identity records
  • Adds interactive sections for certificates, country browsing, AI-style insights, charts, world clocks, portfolio tracking, global feeds, crypto tools, password and hash generation, and system diagnostics
  • Adds append-only registry and certificate verification examples using browser storage and SHA-256 hashing
  • Includes owner profile details, external links, personal identifiers, and mocked or externally sourced market, location, and system data
  • The content is provided as documentation and code snippets in a new file rather than as an integrated application page

Impact

✅ Centralized SGAE dashboard reference
✅ Searchable market, country, certificate, and registry sections
✅ Browser-based monitoring and utility examples

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Berikut adalah kemas kini untuk tukar mesej dari **"Hello"** → **"Goodbye"** pada peristiwa yang betul (masuk vs keluar sesi).

## 1) JavaScript — letak sebelum `</script>`

```js
// ═══════════════════════════════════════════════════════════════════════════
// MODULE: SESSION GREETING (Hello → Goodbye)
// ═══════════════════════════════════════════════════════════════════════════

const SESSION = {
  greeting: 'Hello',
  farewell: 'Goodbye',
  startedAt: Date.now(),
};

// ─────────────────────────────────────────────────────────────────────────
// On load — print "Hello"
// ─────────────────────────────────────────────────────────────────────────
function printHello() {
  const name = (typeof CERTIFICATE_IDENTITY !== 'undefined')
    ? CERTIFICATE_IDENTITY.full_name
    : 'SGAE Data Lake';

  console.log(
    `%c👋 ${SESSION.greeting}, ${name}!`,
    'color:#10b981;font-weight:900;font-size:16px;padding:4px 8px;background:rgba(16,185,129,0.1);border-radius:4px;'
  );

  // Also show a toast (optional — comment out if tak mahu)
  showToast(
    `👋 ${SESSION.greeting}`,
    `Selamat datang, ${name}. Sesi dimulakan.`,
    'success'
  );
}

// ─────────────────────────────────────────────────────────────────────────
// On exit — update "Hello" → "Goodbye"
// ─────────────────────────────────────────────────────────────────────────
function printGoodbye() {
  const name = (typeof CERTIFICATE_IDENTITY !== 'undefined')
    ? CERTIFICATE_IDENTITY.full_name
    : 'SGAE Data Lake';
  const secs = Math.round((Date.now() - SESSION.startedAt) / 1000);
  const mm = String(Math.floor(secs / 60)).padStart(2, '0');
  const ss = String(secs % 60).padStart(2, '0');

  // Change greeting state
  SESSION.greeting = SESSION.farewell;

  console.log(
    `%c👋 ${SESSION.farewell}, ${name}!`,
    'color:#fbbf24;font-weight:900;font-size:16px;padding:4px 8px;background:rgba(251,191,36,0.1);border-radius:4px;'
  );
  console.log(
    `%c⏱️ Sesi tamat: ${mm}:${ss}  ·  ${new Date().toLocaleString('ms-MY')}`,
    'color:#94a3b8;font-style:italic;'
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Bind events
// ─────────────────────────────────────────────────────────────────────────
window.addEventListener('load', () => {
  setTimeout(printHello, 800);
});

// Fires when tab is closed, navigated away, or refreshed
window.addEventListener('beforeunload', printGoodbye);

// Fires when tab becomes hidden (mobile, tab switch) — optional
document.addEventListener('visibilitychange', () => {
  if (document.visibilityState === 'hidden') {
    // Change state only — no console spam
    SESSION.greeting = SESSION.farewell;
  } else if (document.visibilityState === 'visible' && SESSION.greeting === SESSION.farewell) {
    // User came back — reset greeting to Hello
    SESSION.greeting = 'Hello';
    console.log('%c👋 Hello again — sesi disambung', 'color:#22d3ee;font-weight:bold;');
  }
});
```

## 2) (Pilihan) UI Banner — Tukar visual dari "Hello" → "Goodbye"

Jika mahu ia kelihatan dalam UI juga, tambah elemen kecil dan kemas kini melalui JavaScript:

**HTML** — letak di dalam `.toolbar` (kanan sekali):

```html
<span id="session-badge" class="session-badge">
  <i class="fas fa-hand-wave"></i> <span id="session-text">Hello</span>
</span>
```

**CSS** — tambah dalam `<style>`:

```css
.session-badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 12px;border-radius:20px;
  background:rgba(16,185,129,0.12);
  border:1px solid rgba(16,185,129,0.4);
  color:var(--green);
  font-size:0.68rem;font-weight:800;
  letter-spacing:0.06em;
  transition:all 0.4s ease;
}
.session-badge.goodbye{
  background:rgba(251,191,36,0.12);
  border-color:rgba(251,191,36,0.4);
  color:var(--gold);
}
.session-badge i{
  animation:wave 2s ease-in-out infinite;
  display:inline-block;
  transform-origin:70% 70%;
}
@Keyframes wave{
  0%,60%,100%{transform:rotate(0);}
  10%,30%{transform:rotate(14deg);}
  20%,40%{transform:rotate(-8deg);}
}
```

**JavaScript** — kemas kini `printHello()` dan `printGoodbye()`:

```js
function printHello() {
  // ... existing console.log ...

  const badge = document.getElementById('session-badge');
  const text = document.getElementById('session-text');
  if (badge && text) {
    badge.classList.remove('goodbye');
    text.textContent = 'Hello';
  }
}

function printGoodbye() {
  // ... existing console.log ...

  const badge = document.getElementById('session-badge');
  const text = document.getElementById('session-text');
  if (badge && text) {
    badge.classList.add('goodbye');
    text.textContent = 'Goodbye';
  }
}
```

## 3) Ringkasan Perubahan

| Keadaan | Sebelum | Selepas |
|---|---|---|
| **Console (load)** | `Hello` | `👋 Hello, Muhamad Sazwan Bin Ismail!` (hijau) |
| **Console (exit)** | `Hello` | `👋 Goodbye, Muhamad Sazwan Bin Ismail!` (kuning) |
| **Console (tab hidden)** | — | state tukar ke `Goodbye` secara senyap |
| **Console (tab visible semula)** | — | `👋 Hello again — sesi disambung` (biru) |
| **UI badge** | `Hello` (hijau) | `Goodbye` (kuning) bila keluar |

### Peristiwa yang Mencetuskan

| Event | Bila Berlaku | Tindakan |
|---|---|---|
| `load` | Halaman siap dimuatkan | Print **Hello** + toast |
| `beforeunload` | Tab ditutup / refresh / navigate away | Print **Goodbye** |
| `visibilitychange` → hidden | Tukar tab / minimize (mobile) | Tukar state secara senyap |
| `visibilitychange` → visible | Balik ke tab | Print **Hello again** |

### Nota

- **`beforeunload`** tidak boleh guna operasi async (macam `fetch`) — jadi kita hanya `console.log` dan tukar state, yang cukup laju untuk browser
- Jika mahu **log keluar disimpan**, boleh tambah `navigator.sendBeacon('/api/log', ...)` — tetapi untuk personal dashboard, `console.log` sudah memadai
- **Toast "Hello"** boleh dimatikan dengan comment out `showToast(...)` dalam `printHello()` jika tak mahu ia muncul setiap kali refresh

Kalau mahu ia spesifik ke satu elemen sahaja (contohnya `console.log` dalam fungsi tertentu), beritahu saya di mana asalnya "Hello" berada — saya boleh tukar terus pada baris yang betul.
@Sazwanismail Sazwanismail self-assigned this Sep 30, 2026
@Sazwanismail Sazwanismail added documentation Improvements or additions to documentation Perfect zass Kemenangan Semuanya Untuk Celaka Bewak labels Sep 30, 2026
@Sazwanismail Sazwanismail added Media Sosial media Windows hunter Projects personal Win Kemenangan labels Sep 30, 2026
@changeset-bot

changeset-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c08947a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Sazwanismail Sazwanismail added Strategic Kecekapan semulajadi size:XXL This PR changes 1000+ lines, ignoring generated files size:M This PR changes 30-99 lines, ignoring generated files size:XL This PR changes 500-999 lines, ignoring generated files size:XS This PR changes 0-9 lines, ignoring generated files labels Sep 30, 2026
@codeant-ai

codeant-ai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR c08947a Sep 30, 2026 · 21:38 21:39

@codeant-ai

codeant-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@Sazwanismail
Sazwanismail merged commit 6c1555f into main Sep 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Media Sosial media Perfect zass Kemenangan Semuanya Untuk Celaka Bewak size:M This PR changes 30-99 lines, ignoring generated files size:XL This PR changes 500-999 lines, ignoring generated files size:XS This PR changes 0-9 lines, ignoring generated files size:XXL This PR changes 1000+ lines, ignoring generated files Strategic Kecekapan semulajadi Win Kemenangan Windows hunter Projects personal

Projects

Development

Successfully merging this pull request may close these issues.

[Draft] New Issue in codespaces-react docs.github.com/codespaces All language

1 participant