more friends fixes
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 32s
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 32s
This commit is contained in:
@@ -41,7 +41,7 @@ const authLimiter = rateLimit({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const apiLimiter = rateLimit({
|
const apiLimiter = rateLimit({
|
||||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
windowMs: 5 * 60 * 1000, // 5 minutes
|
||||||
max: 100, // 100 requests per window
|
max: 100, // 100 requests per window
|
||||||
message: { error: 'Too many requests, please try again later.' },
|
message: { error: 'Too many requests, please try again later.' },
|
||||||
standardHeaders: true,
|
standardHeaders: true,
|
||||||
|
|||||||
@@ -178,10 +178,11 @@ export default function Friends() {
|
|||||||
borderBottom: '1px solid var(--border)',
|
borderBottom: '1px solid var(--border)',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
|
gap: '1rem'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<div style={{ fontWeight: 500 }}>{user.username}</div>
|
<div style={{ fontWeight: 500 }}>{user.username}</div>
|
||||||
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{user.email}</div>
|
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{user.email}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,6 +190,7 @@ export default function Friends() {
|
|||||||
className="btn btn-primary btn-sm"
|
className="btn btn-primary btn-sm"
|
||||||
onClick={() => handleSendRequest(user.id)}
|
onClick={() => handleSendRequest(user.id)}
|
||||||
disabled={sending === user.id}
|
disabled={sending === user.id}
|
||||||
|
style={{ flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
{sending === user.id ? 'Sending...' : 'Add Friend'}
|
{sending === user.id ? 'Sending...' : 'Add Friend'}
|
||||||
</button>
|
</button>
|
||||||
@@ -204,12 +206,12 @@ export default function Friends() {
|
|||||||
<h3 style={{ marginBottom: '1rem' }}>Friend Requests</h3>
|
<h3 style={{ marginBottom: '1rem' }}>Friend Requests</h3>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
||||||
{requests.map(req => (
|
{requests.map(req => (
|
||||||
<div key={req.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
<div key={req.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '1rem' }}>
|
||||||
<div>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<div style={{ fontWeight: 500 }}>{req.username}</div>
|
<div style={{ fontWeight: 500 }}>{req.username}</div>
|
||||||
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{req.email}</div>
|
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{req.email}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
<div style={{ display: 'flex', gap: '0.5rem', flexShrink: 0 }}>
|
||||||
<button
|
<button
|
||||||
className="btn btn-success btn-sm"
|
className="btn btn-success btn-sm"
|
||||||
onClick={() => handleRespond(req.id, 'accepted')}
|
onClick={() => handleRespond(req.id, 'accepted')}
|
||||||
@@ -239,17 +241,18 @@ export default function Friends() {
|
|||||||
) : (
|
) : (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
||||||
{friends.map(friend => (
|
{friends.map(friend => (
|
||||||
<div key={friend.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
<div key={friend.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '1rem' }}>
|
||||||
<div>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<div style={{ fontWeight: 500 }}>{friend.username}</div>
|
<div style={{ fontWeight: 500 }}>{friend.username}</div>
|
||||||
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{friend.email}</div>
|
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{friend.email}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
|
<div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexShrink: 0 }}>
|
||||||
<div style={{ color: 'var(--primary)' }}>{friend.total_points} points</div>
|
<div style={{ color: 'var(--primary)', whiteSpace: 'nowrap' }}>{friend.total_points} points</div>
|
||||||
<button
|
<button
|
||||||
className="btn btn-danger btn-sm"
|
className="btn btn-danger btn-sm"
|
||||||
onClick={() => handleRemoveFriend(friend.id, friend.username)}
|
onClick={() => handleRemoveFriend(friend.id, friend.username)}
|
||||||
disabled={removing === friend.id}
|
disabled={removing === friend.id}
|
||||||
|
style={{ flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
{removing === friend.id ? 'Removing...' : 'Remove'}
|
{removing === friend.id ? 'Removing...' : 'Remove'}
|
||||||
</button>
|
</button>
|
||||||
@@ -271,20 +274,21 @@ export default function Friends() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{challengeFriends.map(friend => (
|
{challengeFriends.map(friend => (
|
||||||
<div key={friend.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
<div key={friend.id} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '1rem' }}>
|
||||||
<div>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<div style={{ fontWeight: 500 }}>{friend.username}</div>
|
<div style={{ fontWeight: 500 }}>{friend.username}</div>
|
||||||
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{friend.email}</div>
|
<div style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>{friend.email}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center' }}>
|
<div style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexShrink: 0, flexWrap: 'nowrap' }}>
|
||||||
<div style={{ color: 'var(--primary)' }}>{friend.total_points} points</div>
|
|
||||||
<button
|
<button
|
||||||
className="btn btn-primary btn-sm"
|
className="btn btn-primary btn-sm"
|
||||||
onClick={() => handleSendRequest(friend.id)}
|
onClick={() => handleSendRequest(friend.id)}
|
||||||
disabled={sending === friend.id}
|
disabled={sending === friend.id}
|
||||||
|
style={{ flexShrink: 0 }}
|
||||||
>
|
>
|
||||||
{sending === friend.id ? 'Sending...' : 'Add Friend'}
|
{sending === friend.id ? 'Sending...' : 'Add Friend'}
|
||||||
</button>
|
</button>
|
||||||
|
<div style={{ color: 'var(--primary)', whiteSpace: 'nowrap' }}>{friend.total_points} points</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user