diff --git a/public/css/style.css b/public/css/style.css index 6b08434..3e7d4a0 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -47,16 +47,17 @@ a:hover { text-decoration: underline; } /* Toggle button pinned to right edge */ .sidebar-toggle-btn { - position: absolute; top: 1.5rem; right: -14px; + position: fixed; top: 1.5rem; left: 226px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-light); font-size: 0.65rem; cursor: pointer; display: flex; align-items: center; justify-content: center; - z-index: 20; transition: background 0.15s, color 0.15s, border-color 0.15s; + z-index: 20; transition: left 0.25s cubic-bezier(.4,0,.2,1), background 0.15s, color 0.15s, border-color 0.15s; box-shadow: 0 2px 6px rgba(0,0,0,0.12); } .sidebar-toggle-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); } + /* Nav link: icon always visible, label collapses */ .nav-link { padding: 0.6rem 0.75rem; border-radius: 0.5rem; @@ -75,6 +76,7 @@ body.sidebar-collapsed .sidebar { width: 64px; } body.sidebar-collapsed .sidebar-label { opacity: 0; width: 0; pointer-events: none; } body.sidebar-collapsed .nav-link { justify-content: center; padding: 0.65rem; gap: 0; } body.sidebar-collapsed .nav-link .badge { position: absolute; top: 2px; right: 2px; padding: 1px 4px; font-size: 0.6rem; } +body.sidebar-collapsed .sidebar-toggle-btn { left: 50px; } body.sidebar-collapsed .sidebar-toggle-btn .fa-chevron-left { display: block; } /* Tooltip on collapsed nav links */ diff --git a/views/dashboard.php b/views/dashboard.php index ad12b0a..c9599e0 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -268,11 +268,11 @@ if (empty($_SESSION['dash_logged_today'])) { - +
- Projects & Files + Files
@@ -295,36 +295,45 @@ if (empty($_SESSION['dash_logged_today'])) {
- -
- - -
-
-

👥 Team Mood

- Live from colleagues -
- -

No one else has set a mood yet.

- -
- -
- - -
- -
- - -
- Your mood is visible to your team: -
- + +
+
+

👥 Team Mood

+ Live from colleagues
+ +

No one else has set a mood yet.

+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + +
+ Your mood is visible to your team: +
+ +
- -
+ +

🕓 Recent Activity

@@ -393,7 +402,6 @@ if (empty($_SESSION['dash_logged_today'])) {
-
@@ -343,6 +357,11 @@ $note_colors = [ $bg = $n['color'] ?: 'var(--surface)'; $preview = strip_tags(isset($n['content']) ? (function_exists('marked') ? $n['content'] : $n['content']) : ''); $preview = mb_substr($preview, 0, 120) . (mb_strlen($preview) > 120 ? '...' : ''); + $note_shares = []; + if($n['is_mine']) { + $note_shares = query("SELECT ns.id, ns.share_type, ns.share_id, u.username, g.name as gname FROM note_shares ns LEFT JOIN users u ON (ns.share_type='user' AND ns.share_id=u.id) LEFT JOIN groups g ON (ns.share_type='group' AND ns.share_id=g.id) WHERE ns.note_id=?", [$n['id']])->fetchAll(); + } + $shares_json = htmlspecialchars(json_encode($note_shares), ENT_QUOTES, 'UTF-8'); ?>
@@ -479,6 +499,9 @@ function openNote(card) { // Share section document.getElementById('edit-share-section').style.display = isMine ? 'block' : 'none'; + if(isMine) { + renderNoteShares(card.dataset.shares || '[]'); + } // Wire up share button const shareBtn = document.querySelector('#edit-note-form button[name="share_note"]'); @@ -495,6 +518,35 @@ function openNote(card) { document.getElementById('edit-note-modal').classList.add('active'); } +function renderNoteShares(jsonShares) { + const list = document.getElementById('note-shares-list'); + list.innerHTML = ''; + let shares = []; + try { shares = JSON.parse(jsonShares || '[]'); } catch(e) { shares = []; } + if(shares.length === 0) return; + shares.forEach(sh => { + const label = sh.share_type === 'user' ? ('👤 ' + (sh.username || 'User')) : ('👥 ' + (sh.gname || 'Group')); + const chip = document.createElement('div'); + chip.style.display = 'inline-flex'; + chip.style.alignItems = 'center'; + chip.style.gap = '0.35rem'; + chip.style.fontSize = '0.72rem'; + chip.style.padding = '3px 7px'; + chip.style.borderRadius = '999px'; + chip.style.background = 'rgba(var(--primary-rgb),0.12)'; + chip.style.color = 'var(--primary)'; + chip.innerHTML = `${label}`; + list.appendChild(chip); + }); +} + +function removeNoteShare(shareId) { + if(!shareId) return; + if(!confirm('Unshare this note access?')) return; + document.getElementById('remove-note-share-id').value = String(shareId); + document.getElementById('remove-note-share-form').submit(); +} + function filterNotes() { const q = (document.getElementById('notes-search-input')?.value || '').toLowerCase().trim(); const lbl = (document.getElementById('notes-label-filter')?.value || '').trim(); diff --git a/views/projects.php b/views/projects.php index fae1bdb..5f6bc3f 100644 --- a/views/projects.php +++ b/views/projects.php @@ -41,6 +41,14 @@ if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['share_project'])) { } } +if($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['remove_project_share'])) { + $share_id = (int)$_POST['share_id']; + $chk = query("SELECT ps.id FROM project_shares ps JOIN projects p ON ps.project_id=p.id WHERE ps.id=? AND p.owner_id=?", [$share_id, $user_id])->fetch(); + if($chk) { + $pdo->prepare("DELETE FROM project_shares WHERE id=?")->execute([$share_id]); + } +} + // ── Fetch current folder content ────────────────────────────────────────────── $user_groups = get_user_groups($user_id); $my_group_ids = array_column($user_groups, 'id'); @@ -138,6 +146,11 @@ function get_file_icon($name, $is_folder) { + +