Skip to content

Commit ebdfb5f

Browse files
committed
feat: Ufak hatalar.
1 parent d7e078a commit ebdfb5f

2 files changed

Lines changed: 67 additions & 23 deletions

File tree

src/pages/index.astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ const navItems = [
156156
<div class="item-actions">
157157
<a class="action-btn action-comment" href={`/blog/${post.slug}/#comments`} aria-label="Yorumlar">
158158
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8A2.5 2.5 0 0 1 17.5 16H9l-5 5v-5.5A2.5 2.5 0 0 1 1.5 13V5.5Z"/></svg>
159-
<span data-comment-count>0</span>
159+
<span data-comment-count aria-busy="true">…</span>
160160
</a>
161161
<button class="action-btn action-share" data-copy-link type="button" aria-label="Bağlantıyı kopyala">
162162
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 3h9a2 2 0 0 1 2 2v9h-2V5h-9V3Zm-3 4h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Zm0 2v10h9V9H6Z"/></svg>
163163
<span>Kopyala</span>
164164
</button>
165165
<button class="action-btn action-like" data-like-toggle type="button" aria-label="Beğeniler">
166166
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12.1 21.35 10.65 20C5.4 15.36 2 12.28 2 8.5A4.5 4.5 0 0 1 6.5 4C8.24 4 9.91 4.81 11 6.09 12.09 4.81 13.76 4 15.5 4A4.5 4.5 0 0 1 20 8.5c0 3.78-3.4 6.86-8.65 11.5l-1.25 1.35Z"/></svg>
167-
<span data-like-count>0</span>
167+
<span data-like-count aria-busy="true">…</span>
168168
</button>
169169
<span class="date-meta">
170170
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 2h2v2h6V2h2v2h3v18H4V4h3V2Zm11 8H6v10h12V10Z"/></svg>
@@ -256,6 +256,8 @@ const navItems = [
256256

257257
commentCountEl.textContent = String(commentSnap.data().count || 0);
258258
likeCountEl.textContent = String(likeSnap.data().count || 0);
259+
commentCountEl.setAttribute('aria-busy', 'false');
260+
likeCountEl.setAttribute('aria-busy', 'false');
259261
} catch (error) {
260262
console.error('Sayaç verisi alınamadı:', postId, error);
261263
}
@@ -556,6 +558,6 @@ const navItems = [
556558
.mobile-cats { display:flex; gap:0.45rem; overflow-x:auto; padding-bottom:0.1rem; scrollbar-width:none; }
557559
.mobile-cats::-webkit-scrollbar { display:none; }
558560
.mobile-cats a { white-space:nowrap; color:var(--secondary); border:1px solid var(--border); background:var(--muted); border-radius:999px; padding:0.32rem 0.65rem; font-size:0.8rem; text-decoration:none; }
559-
@media (max-width: 700px) { .feed-item { grid-template-columns:40px minmax(0,1fr); gap:0.7rem; padding:0.85rem; } .action-share span,.action-like span { display:none; } .item-actions .read-more-link { margin-left:0; } }
561+
@media (max-width: 700px) { .feed-item { grid-template-columns:40px minmax(0,1fr); gap:0.7rem; padding:0.85rem; } .action-share span { display:none; } .item-actions .read-more-link { margin-left:0; } }
560562
</style>
561563
</BaseLayout>

src/pages/profil.astro

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,24 @@ const navItems = [
8888
import { isUsernameBanned } from '../utils/blacklist.js';
8989

9090
const provider = new GoogleAuthProvider();
91-
const shell = document.querySelector('[data-profile-shell]');
92-
if (!shell) console.warn('Profile shell bulunamadı, profil init atlandı.');
9391

94-
const userPanel = shell?.querySelector('[data-user-panel]');
95-
const authGuard = shell?.querySelector('[data-auth-guard]');
96-
const dashboard = shell?.querySelector('[data-dashboard]');
97-
const userAvatar = shell?.querySelector('[data-user-avatar]');
98-
const userFallback = shell?.querySelector('[data-user-fallback]');
99-
const userName = shell?.querySelector('[data-user-name]');
100-
const userEmail = shell?.querySelector('[data-user-email]');
101-
const userHandle = shell?.querySelector('[data-user-handle]');
102-
const usernameClaim = shell?.querySelector('[data-username-claim]');
103-
const usernameInput = shell?.querySelector('[data-username-input]');
104-
const usernameSaveBtn = shell?.querySelector('[data-username-save]');
105-
const usernameMsg = shell?.querySelector('[data-username-msg]');
106-
const likesList = shell?.querySelector('[data-likes-list]');
107-
const likeCount = shell?.querySelector('[data-like-count]');
108-
const loginBtn = shell?.querySelector('[data-login-btn]');
109-
const logoutBtn = document.querySelector('[data-logout-btn]');
92+
let shell = null;
93+
let userPanel = null;
94+
let authGuard = null;
95+
let dashboard = null;
96+
let userAvatar = null;
97+
let userFallback = null;
98+
let userName = null;
99+
let userEmail = null;
100+
let userHandle = null;
101+
let usernameClaim = null;
102+
let usernameInput = null;
103+
let usernameSaveBtn = null;
104+
let usernameMsg = null;
105+
let likesList = null;
106+
let likeCount = null;
107+
let loginBtn = null;
108+
let logoutBtn = null;
110109

111110
let likesUnsub = null;
112111
let authUnsub = null;
@@ -206,7 +205,29 @@ const navItems = [
206205
};
207206

208207
const bootProfile = async () => {
209-
if (!shell) return;
208+
shell = document.querySelector('[data-profile-shell]');
209+
if (!shell) {
210+
console.warn('Profile shell bulunamadı, profil init atlandı.');
211+
return;
212+
}
213+
214+
userPanel = shell.querySelector('[data-user-panel]');
215+
authGuard = shell.querySelector('[data-auth-guard]');
216+
dashboard = shell.querySelector('[data-dashboard]');
217+
userAvatar = shell.querySelector('[data-user-avatar]');
218+
userFallback = shell.querySelector('[data-user-fallback]');
219+
userName = shell.querySelector('[data-user-name]');
220+
userEmail = shell.querySelector('[data-user-email]');
221+
userHandle = shell.querySelector('[data-user-handle]');
222+
usernameClaim = shell.querySelector('[data-username-claim]');
223+
usernameInput = shell.querySelector('[data-username-input]');
224+
usernameSaveBtn = shell.querySelector('[data-username-save]');
225+
usernameMsg = shell.querySelector('[data-username-msg]');
226+
likesList = shell.querySelector('[data-likes-list]');
227+
likeCount = shell.querySelector('[data-like-count]');
228+
loginBtn = shell.querySelector('[data-login-btn]');
229+
logoutBtn = document.querySelector('[data-logout-btn]');
230+
210231
if (loginBtn && !loginBtn.dataset.bound) {
211232
loginBtn.dataset.bound = '1';
212233
loginBtn.addEventListener('click', async () => { try { await signInWithPopup(auth, provider); } catch (error) { console.error('Giriş hatası:', error); } });
@@ -252,7 +273,28 @@ const navItems = [
252273
});
253274
};
254275

255-
const cleanupProfile = () => { cleanupLikesListener(); if (authUnsub) { try { authUnsub(); } catch {} authUnsub = null; } currentUser = null; };
276+
const cleanupProfile = () => {
277+
cleanupLikesListener();
278+
if (authUnsub) { try { authUnsub(); } catch {} authUnsub = null; }
279+
currentUser = null;
280+
shell = null;
281+
userPanel = null;
282+
authGuard = null;
283+
dashboard = null;
284+
userAvatar = null;
285+
userFallback = null;
286+
userName = null;
287+
userEmail = null;
288+
userHandle = null;
289+
usernameClaim = null;
290+
usernameInput = null;
291+
usernameSaveBtn = null;
292+
usernameMsg = null;
293+
likesList = null;
294+
likeCount = null;
295+
loginBtn = null;
296+
logoutBtn = null;
297+
};
256298
bootProfile(); document.addEventListener('astro:page-load', bootProfile); document.addEventListener('astro:before-swap', cleanupProfile);
257299
</script>
258300
</AppShell>

0 commit comments

Comments
 (0)