Admin
This commit is contained in:
+100
-11
@@ -42,6 +42,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
private Dictionary<int, string?> _mobSpriteConfigs = new(); // MobDefinitionId -> SpriteConfig JSON
|
||||
private bool _initialized = false;
|
||||
|
||||
|
||||
// Tick management
|
||||
private Timer? _tickTimer;
|
||||
private long _currentTick = 0;
|
||||
@@ -1096,7 +1097,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
|
||||
// Process pending broadcasts
|
||||
ProcessPendingBroadcasts();
|
||||
|
||||
|
||||
// Update active connection count for admin display
|
||||
_broadcastService.SetActiveConnectionCount(_playerSessions.Count);
|
||||
|
||||
@@ -1113,10 +1114,8 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
{
|
||||
if (death.EntityType == EntityType.Mob && death.KillerType == EntityType.Player)
|
||||
{
|
||||
// Fire and forget loot generation (async in sync context)
|
||||
_ = ProcessMobDeathLootAsync(instance, death);
|
||||
|
||||
// Check if this was a boss kill
|
||||
|
||||
if (instance.Simulation.Mobs.TryGetValue(death.EntityId, out var killedMob))
|
||||
{
|
||||
if (killedMob.Type == MobType.Boss)
|
||||
@@ -1128,17 +1127,109 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
}
|
||||
else if (death.EntityType == EntityType.Player)
|
||||
{
|
||||
// Player died - transfer loot to killer
|
||||
_ = ProcessPlayerDeathLootTransferAsync(instance, death);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send state to all players in this dungeon
|
||||
// Get players in this dungeon
|
||||
var playersInDungeon = _playerSessions.Values
|
||||
.Where(s => s.CurrentDungeonId == dungeonId && s.State == PlayerState.InDungeon)
|
||||
.ToList();
|
||||
|
||||
// ==================== TILE UPDATE BROADCASTING ====================
|
||||
// Check for pending tile updates from admin editing
|
||||
if (instance.HasPendingTileUpdates && instance.LayoutV2 != null && playersInDungeon.Count > 0)
|
||||
{
|
||||
instance.HasPendingTileUpdates = false;
|
||||
|
||||
// Get changed tiles if we're tracking them, otherwise send all
|
||||
object[] tilesToSend;
|
||||
object[]? walkableUpdates = null;
|
||||
|
||||
if (_changedTiles.TryRemove(dungeonId, out var changes) && changes.Count > 0)
|
||||
{
|
||||
// Differential update - only send changed tiles
|
||||
var changedList = changes.ToList();
|
||||
var tileDetails = instance.LayoutV2.TileDetails;
|
||||
|
||||
tilesToSend = changedList
|
||||
.Select(c => {
|
||||
var tile = tileDetails.FirstOrDefault(t => t.X == c.x && t.Y == c.y && t.Layer == c.layer);
|
||||
if (tile != null)
|
||||
{
|
||||
return new
|
||||
{
|
||||
x = tile.X,
|
||||
y = tile.Y,
|
||||
sid = tile.SheetId,
|
||||
frame = tile.FrameIndex,
|
||||
l = tile.Layer,
|
||||
r = tile.Rotation,
|
||||
fx = tile.FlipX,
|
||||
fy = tile.FlipY
|
||||
};
|
||||
}
|
||||
// Tile was removed - send with sid=0 to indicate removal
|
||||
return new
|
||||
{
|
||||
x = c.x,
|
||||
y = c.y,
|
||||
sid = 0,
|
||||
frame = 0,
|
||||
l = c.layer,
|
||||
r = 0,
|
||||
fx = false,
|
||||
fy = false
|
||||
};
|
||||
})
|
||||
.Cast<object>()
|
||||
.ToArray();
|
||||
|
||||
// Also send walkable updates for changed positions
|
||||
var layout = instance.LayoutV2;
|
||||
walkableUpdates = changedList
|
||||
.Select(c => c.layer == 0 ? new { x = c.x, y = c.y, w = layout.Walkable[c.x, c.y] } : null)
|
||||
.Where(w => w != null)
|
||||
.Distinct()
|
||||
.Cast<object>()
|
||||
.ToArray();
|
||||
|
||||
_log.LogInformation("Broadcasting {Count} tile updates to {PlayerCount} players in dungeon {Id}",
|
||||
tilesToSend.Length, playersInDungeon.Count, dungeonId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Full update - send all tiles (fallback, shouldn't happen often)
|
||||
tilesToSend = instance.LayoutV2.TileDetails.Select(t => new {
|
||||
x = t.X,
|
||||
y = t.Y,
|
||||
sid = t.SheetId,
|
||||
frame = t.FrameIndex,
|
||||
l = t.Layer,
|
||||
r = t.Rotation,
|
||||
fx = t.FlipX,
|
||||
fy = t.FlipY
|
||||
}).Cast<object>().ToArray();
|
||||
|
||||
_log.LogInformation("Broadcasting full tile update ({Count} tiles) to {PlayerCount} players in dungeon {Id}",
|
||||
tilesToSend.Length, playersInDungeon.Count, dungeonId);
|
||||
}
|
||||
|
||||
// Broadcast to all players in this dungeon
|
||||
var tileUpdate = new
|
||||
{
|
||||
tiles = tilesToSend,
|
||||
walkable = walkableUpdates
|
||||
};
|
||||
|
||||
foreach (var session in playersInDungeon)
|
||||
{
|
||||
_ = SendAsync(session.Connection, DungeonOpCodes.DUNGEON_TILE_UPDATE, tileUpdate, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
// ==================== END TILE UPDATE BROADCASTING ====================
|
||||
|
||||
// Check if dungeon was just cleared
|
||||
if (result.Phase == DungeonPhase.Cleared && !instance.ClearedHandled)
|
||||
{
|
||||
@@ -1147,7 +1238,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
{
|
||||
_ = HandleDungeonClearedAsync(session);
|
||||
}
|
||||
continue; // Skip normal state updates since we're returning everyone to hub
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var session in playersInDungeon)
|
||||
@@ -1179,8 +1270,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
if (playersInDungeon.Count == 0)
|
||||
{
|
||||
var emptyTime = DateTime.UtcNow - instance.LastPlayerActivity;
|
||||
|
||||
// If boss not killed and empty for 10+ minutes, persist to database
|
||||
|
||||
if (!instance.BossKilled && !instance.IsPersisted && emptyTime.TotalMinutes >= 5)
|
||||
{
|
||||
_ = PersistDungeonAsync(instance, CancellationToken.None);
|
||||
@@ -1188,7 +1278,6 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
_ = TrackDungeonDestroyedAsync(dungeonId);
|
||||
_log.LogInformation("Dungeon {Id} persisted after 10 minutes empty", dungeonId);
|
||||
}
|
||||
// If boss killed and empty for 5+ minutes, just remove (cleared)
|
||||
else if (instance.BossKilled && emptyTime.TotalMinutes >= 5)
|
||||
{
|
||||
_dungeons.TryRemove(dungeonId, out _);
|
||||
@@ -1203,7 +1292,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Process pending server broadcasts and send to all connected players
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,18 @@ namespace GameServer.Dungeon;
|
||||
/// </summary>
|
||||
public partial class DungeonHandler
|
||||
{
|
||||
// Track changed tiles per dungeon for differential updates
|
||||
private readonly ConcurrentDictionary<Guid, ConcurrentBag<(int x, int y, int layer)>> _changedTiles = new();
|
||||
|
||||
/// <summary>
|
||||
/// Mark a tile as changed for differential updates
|
||||
/// </summary>
|
||||
public void MarkTileChanged(Guid dungeonId, int x, int y, int layer = 0)
|
||||
{
|
||||
var bag = _changedTiles.GetOrAdd(dungeonId, _ => new ConcurrentBag<(int, int, int)>());
|
||||
bag.Add((x, y, layer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all active dungeon instances (for admin viewing)
|
||||
/// </summary>
|
||||
@@ -246,6 +258,7 @@ public partial class DungeonHandler
|
||||
}
|
||||
|
||||
// Mark dungeon as having pending tile updates
|
||||
MarkTileChanged(dungeonId, x, y, layer);
|
||||
dungeon.HasPendingTileUpdates = true;
|
||||
|
||||
return true;
|
||||
@@ -300,6 +313,9 @@ public partial class DungeonHandler
|
||||
TileDefinitionId = (int)tile.TileDefId
|
||||
});
|
||||
}
|
||||
|
||||
// Track change for differential update
|
||||
MarkTileChanged(dungeonId, tileX, tileY, tile.Layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,6 +350,9 @@ public partial class DungeonHandler
|
||||
TileDefinitionId = tileDef.Id
|
||||
});
|
||||
}
|
||||
|
||||
// Track change for differential update
|
||||
MarkTileChanged(dungeonId, x, y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,12 +374,30 @@ public partial class DungeonHandler
|
||||
if (layer.HasValue)
|
||||
{
|
||||
layout.TileDetails.RemoveAll(t => t.X == x && t.Y == y && t.Layer == layer.Value);
|
||||
MarkTileChanged(dungeonId, x, y, layer.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove all layers at this position
|
||||
var removedLayers = layout.TileDetails
|
||||
.Where(t => t.X == x && t.Y == y)
|
||||
.Select(t => t.Layer)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
layout.TileDetails.RemoveAll(t => t.X == x && t.Y == y);
|
||||
layout.Walkable[x, y] = false;
|
||||
layout.Tiles[x, y] = 0;
|
||||
|
||||
// Mark all removed layers as changed
|
||||
foreach (var l in removedLayers)
|
||||
{
|
||||
MarkTileChanged(dungeonId, x, y, l);
|
||||
}
|
||||
if (removedLayers.Count == 0)
|
||||
{
|
||||
MarkTileChanged(dungeonId, x, y, 0); // At least mark ground layer
|
||||
}
|
||||
}
|
||||
|
||||
dungeon.HasPendingTileUpdates = true;
|
||||
@@ -436,6 +473,66 @@ public partial class DungeonHandler
|
||||
player.Armor = invulnerable ? 999999 : 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get dungeons with pending tile updates (for tick loop)
|
||||
/// </summary>
|
||||
public IEnumerable<DungeonInstance> GetDungeonsWithPendingTileUpdates()
|
||||
{
|
||||
return _dungeons.Values.Where(d => d.HasPendingTileUpdates);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build tile update payload for broadcasting to clients
|
||||
/// </summary>
|
||||
public object? BuildTileUpdatePayload(Guid dungeonId)
|
||||
{
|
||||
if (!_dungeons.TryGetValue(dungeonId, out var dungeon))
|
||||
return null;
|
||||
|
||||
if (!dungeon.HasPendingTileUpdates)
|
||||
return null;
|
||||
|
||||
dungeon.HasPendingTileUpdates = false;
|
||||
|
||||
var layout = dungeon.LayoutV2;
|
||||
if (layout == null)
|
||||
return null;
|
||||
|
||||
// Build walkability data
|
||||
var walkable = new List<bool>();
|
||||
for (int y = 0; y < layout.Height; y++)
|
||||
for (int x = 0; x < layout.Width; x++)
|
||||
walkable.Add(layout.Walkable[x, y]);
|
||||
|
||||
return new
|
||||
{
|
||||
width = layout.Width,
|
||||
height = layout.Height,
|
||||
walkable = walkable,
|
||||
tiles = layout.TileDetails.Select(t => new
|
||||
{
|
||||
x = t.X,
|
||||
y = t.Y,
|
||||
sid = t.SheetId,
|
||||
frame = t.FrameIndex,
|
||||
l = t.Layer,
|
||||
r = t.Rotation,
|
||||
fx = t.FlipX,
|
||||
fy = t.FlipY
|
||||
}),
|
||||
sheets = layout.TileMapSheets.Select(s => new
|
||||
{
|
||||
id = s.Id,
|
||||
path = s.CdnPath,
|
||||
tileW = s.TileWidth,
|
||||
tileH = s.TileHeight,
|
||||
sheetW = s.SheetWidth,
|
||||
sheetH = s.SheetHeight,
|
||||
cols = s.Columns
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
@@ -462,3 +559,31 @@ public class DungeonStats
|
||||
public int CompletedCount { get; set; }
|
||||
public int BossesKilled { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tile update payload for broadcasting to clients
|
||||
/// </summary>
|
||||
public class TileUpdatePayload
|
||||
{
|
||||
public List<TileUpdateData> Tiles { get; set; } = new();
|
||||
public List<WalkableUpdateData> Walkable { get; set; } = new();
|
||||
}
|
||||
|
||||
public class TileUpdateData
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public int SheetId { get; set; }
|
||||
public int Frame { get; set; }
|
||||
public int Layer { get; set; }
|
||||
public int Rotation { get; set; }
|
||||
public bool FlipX { get; set; }
|
||||
public bool FlipY { get; set; }
|
||||
}
|
||||
|
||||
public class WalkableUpdateData
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public bool Walkable { get; set; }
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ public static class DungeonOpCodes
|
||||
public const int DUNGEON_STATE = 302;
|
||||
public const int DUNGEON_LEAVE = 303;
|
||||
public const int DUNGEON_CLEARED = 304;
|
||||
|
||||
public const int DUNGEON_TILE_UPDATE = 305;
|
||||
|
||||
// Dungeon Browser (310-319)
|
||||
public const int DUNGEON_LIST_REQUEST = 310;
|
||||
public const int DUNGEON_LIST_RESPONSE = 311;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<style>
|
||||
.dungeon-map { background: #0a0a15; border: 2px solid #374151; border-radius: 8px; overflow: hidden; position: relative; }
|
||||
.map-viewport { overflow: auto; max-height: 600px; position: relative; }
|
||||
.map-viewport { overflow: auto; height: calc(100vh - 350px); min-height: 400px; position: relative; }
|
||||
.map-canvas { image-rendering: pixelated; cursor: crosshair; display: block; }
|
||||
.map-canvas.edit-mode { cursor: cell; }
|
||||
.entity-layer { position: absolute; top: 0; left: 0; pointer-events: none; }
|
||||
@@ -59,9 +59,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="flex flex-col lg:flex-row gap-6">
|
||||
<!-- Left: Map View -->
|
||||
<div class="flex-1">
|
||||
<div class="flex flex-col xl:flex-row gap-4">
|
||||
<!-- Left: Map View (50% on large screens) -->
|
||||
<div class="w-full xl:w-1/2">
|
||||
<div class="card p-4">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-xl font-semibold text-white">Live Dungeon Map</h2>
|
||||
@@ -152,8 +152,8 @@ else
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right: Info Panel -->
|
||||
<div class="w-full lg:w-80 space-y-4">
|
||||
<!-- Right: Info Panel (50% on large screens) -->
|
||||
<div class="w-full xl:w-1/2 space-y-4">
|
||||
<div class="stat-card">
|
||||
<h3 class="text-lg font-semibold text-white mb-3">Dungeon Info</h3>
|
||||
<div class="space-y-2 text-sm">
|
||||
|
||||
@@ -9,20 +9,15 @@
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: '#6366f1',
|
||||
secondary: '#8b5cf6',
|
||||
}
|
||||
}
|
||||
}
|
||||
theme: { extend: { colors: { primary: '#6366f1', secondary: '#8b5cf6' } } }
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; color: #d1d5db; border-radius: 0.5rem; transition: all 0.15s; }
|
||||
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; color: #d1d5db; border-radius: 0.5rem; transition: all 0.15s; white-space: nowrap; overflow: hidden; }
|
||||
.sidebar-link:hover { background-color: #1f2937; color: white; }
|
||||
.sidebar-link.active { background-color: #4f46e5; color: white; }
|
||||
.sidebar-link svg { flex-shrink: 0; }
|
||||
|
||||
.btn { padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 500; transition: all 0.15s; outline: none; }
|
||||
.btn:focus { box-shadow: 0 0 0 2px #111827, 0 0 0 4px #6366f1; }
|
||||
.btn-primary { background-color: #4f46e5; color: white; }
|
||||
@@ -39,250 +34,161 @@
|
||||
.input:focus { outline: none; box-shadow: 0 0 0 2px #6366f1; border-color: transparent; }
|
||||
.label { display: block; font-size: 0.875rem; font-weight: 500; color: #d1d5db; margin-bottom: 0.25rem; }
|
||||
.card { background-color: #1f2937; border-radius: 0.75rem; border: 1px solid #374151; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
|
||||
.table-header { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 500; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
.table-header { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 500; color: #9ca3af; text-transform: uppercase; }
|
||||
.table-cell { padding: 0.75rem 1rem; font-size: 0.875rem; color: #d1d5db; }
|
||||
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
|
||||
.badge-common { background-color: #4b5563; color: #e5e7eb; }
|
||||
.badge-uncommon { background-color: #16a34a; color: white; }
|
||||
.badge-rare { background-color: #2563eb; color: white; }
|
||||
.badge-epic { background-color: #9333ea; color: white; }
|
||||
.badge-legendary { background-color: #f97316; color: white; }
|
||||
|
||||
/* Drawer styles */
|
||||
.drawer-overlay {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.3s, visibility 0.3s;
|
||||
}
|
||||
.drawer-overlay.open {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
.drawer-sidebar {
|
||||
transform: translateX(-100%);
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
.drawer-sidebar.open {
|
||||
transform: translateX(0);
|
||||
/* Collapsible sidebar */
|
||||
.sidebar { width: 240px; transition: width 0.3s ease; }
|
||||
.sidebar.collapsed { width: 56px; }
|
||||
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 0.625rem 0.5rem; }
|
||||
.sidebar.collapsed .sidebar-link span,
|
||||
.sidebar.collapsed .section-title,
|
||||
.sidebar.collapsed .logo-text,
|
||||
.sidebar.collapsed .user-info { display: none; }
|
||||
.sidebar.collapsed .collapse-btn svg { transform: rotate(180deg); }
|
||||
|
||||
/* Tooltip for collapsed */
|
||||
.sidebar.collapsed .sidebar-link { position: relative; }
|
||||
.sidebar.collapsed .sidebar-link::after {
|
||||
content: attr(data-tooltip);
|
||||
position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
|
||||
background: #1f2937; color: white; padding: 4px 8px; border-radius: 4px;
|
||||
font-size: 12px; white-space: nowrap; opacity: 0; visibility: hidden;
|
||||
transition: opacity 0.2s; margin-left: 8px; z-index: 100; border: 1px solid #374151;
|
||||
}
|
||||
.sidebar.collapsed .sidebar-link:hover::after { opacity: 1; visibility: visible; }
|
||||
|
||||
/* Mobile drawer */
|
||||
.drawer-overlay { opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
|
||||
.drawer-overlay.open { opacity: 1; visibility: visible; }
|
||||
.drawer-sidebar { transform: translateX(-100%); transition: transform 0.3s ease-in-out; }
|
||||
.drawer-sidebar.open { transform: translateX(0); }
|
||||
@@media (min-width: 1024px) {
|
||||
.drawer-sidebar {
|
||||
transform: translateX(0) !important;
|
||||
}
|
||||
.drawer-overlay {
|
||||
display: none !important;
|
||||
}
|
||||
.mobile-menu-btn {
|
||||
display: none !important;
|
||||
}
|
||||
.drawer-sidebar { transform: translateX(0) !important; }
|
||||
.drawer-overlay { display: none !important; }
|
||||
.mobile-menu-btn { display: none !important; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
<div class="flex h-full">
|
||||
<!-- Mobile overlay -->
|
||||
<div id="drawer-overlay" class="drawer-overlay fixed inset-0 bg-black/50 z-40 lg:hidden" onclick="toggleDrawer()"></div>
|
||||
|
||||
<!-- Sidebar -->
|
||||
<aside id="sidebar" class="drawer-sidebar fixed lg:static inset-y-0 left-0 z-50 w-64 bg-gray-800 border-r border-gray-700 flex flex-col">
|
||||
<!-- Logo -->
|
||||
<div class="p-4 border-b border-gray-700 flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-xl font-bold text-white flex items-center gap-2">
|
||||
<svg class="w-8 h-8 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
|
||||
</svg>
|
||||
Dungeon Divers
|
||||
</h1>
|
||||
<p class="text-xs text-gray-500 mt-1">Admin Panel</p>
|
||||
<aside id="sidebar" class="sidebar drawer-sidebar fixed lg:static inset-y-0 left-0 z-50 bg-gray-800 border-r border-gray-700 flex flex-col">
|
||||
<div class="p-3 border-b border-gray-700 flex items-center gap-2">
|
||||
<svg class="w-7 h-7 text-indigo-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
|
||||
</svg>
|
||||
<div class="logo-text">
|
||||
<h1 class="text-sm font-bold text-white">Dungeon Divers</h1>
|
||||
<p class="text-xs text-gray-500">Admin</p>
|
||||
</div>
|
||||
<!-- Close button for mobile -->
|
||||
<button class="lg:hidden text-gray-400 hover:text-white p-1" onclick="toggleDrawer()">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button class="lg:hidden ml-auto text-gray-400 hover:text-white" onclick="toggleDrawer()">✕</button>
|
||||
</div>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="flex-1 p-4 space-y-1 overflow-y-auto">
|
||||
<a href="/admin" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString() == "/Index" ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/>
|
||||
</svg>
|
||||
Dashboard
|
||||
<button onclick="toggleSidebar()" class="collapse-btn hidden lg:flex items-center justify-center p-2 mx-2 mt-2 text-gray-400 hover:text-white hover:bg-gray-700 rounded">
|
||||
<svg class="w-4 h-4 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19l-7-7 7-7m8 14l-7-7 7-7"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<nav class="flex-1 p-2 space-y-0.5 overflow-y-auto">
|
||||
<a href="/admin" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString() == "/Index" ? "active" : "")" data-tooltip="Dashboard">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/></svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
|
||||
<div class="pt-4">
|
||||
<p class="px-4 text-xs font-semibold text-gray-500 uppercase tracking-wider">Content</p>
|
||||
</div>
|
||||
<p class="section-title px-3 pt-3 pb-1 text-xs font-semibold text-gray-500 uppercase">Content</p>
|
||||
|
||||
<a href="/admin/items" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Items") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"/>
|
||||
</svg>
|
||||
Items
|
||||
<a href="/admin/items" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Items") == true ? "active" : "")" data-tooltip="Items">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"/></svg>
|
||||
<span>Items</span>
|
||||
</a>
|
||||
<a href="/admin/recipes" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Recipes") == true ? "active" : "")" data-tooltip="Recipes">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"/></svg>
|
||||
<span>Recipes</span>
|
||||
</a>
|
||||
<a href="/admin/mobs" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Mobs") == true ? "active" : "")" data-tooltip="Mobs">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/></svg>
|
||||
<span>Mobs</span>
|
||||
</a>
|
||||
<a href="/admin/tilemaps" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/TileMaps") == true ? "active" : "")" data-tooltip="TileMaps">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"/></svg>
|
||||
<span>TileMaps</span>
|
||||
</a>
|
||||
<a href="/admin/dungeonbuilder" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.Contains("DungeonBuilder") == true ? "active" : "")" data-tooltip="Builder">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"/></svg>
|
||||
<span>Builder</span>
|
||||
</a>
|
||||
<a href="/admin/assets" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Assets") == true ? "active" : "")" data-tooltip="Assets">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||
<span>Assets</span>
|
||||
</a>
|
||||
<a href="/admin/loottables" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/LootTables") == true ? "active" : "")" data-tooltip="Loot">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
<span>Loot Tables</span>
|
||||
</a>
|
||||
|
||||
<a href="/admin/recipes" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Recipes") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"/>
|
||||
</svg>
|
||||
Recipes
|
||||
<p class="section-title px-3 pt-3 pb-1 text-xs font-semibold text-gray-500 uppercase">Management</p>
|
||||
|
||||
<a href="/admin/dungeons" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Dungeons") == true ? "active" : "")" data-tooltip="Dungeons">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/></svg>
|
||||
<span>Dungeons</span>
|
||||
</a>
|
||||
|
||||
<a href="/admin/mobs" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Mobs") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/>
|
||||
</svg>
|
||||
Mobs
|
||||
<a href="/admin/players" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Players") == true ? "active" : "")" data-tooltip="Players">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/></svg>
|
||||
<span>Players</span>
|
||||
</a>
|
||||
|
||||
<a href="/admin/abilities" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Abilities") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
|
||||
</svg>
|
||||
Abilities
|
||||
</a>
|
||||
|
||||
<a href="/admin/spritesheets" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/SpriteSheets") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
Sprite Sheets
|
||||
</a>
|
||||
|
||||
<a href="/admin/tilemaps" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/TileMaps") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1V5zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/>
|
||||
</svg>
|
||||
TileMaps
|
||||
</a>
|
||||
|
||||
|
||||
<a href="/admin/dungeonbuilder" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.Contains("DungeonBuilder") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"/>
|
||||
</svg>
|
||||
Dungeon Builder
|
||||
</a>
|
||||
|
||||
<a href="/admin/assets" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Assets") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
CDN Assets
|
||||
</a>
|
||||
|
||||
<a href="/admin/loottables" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/LootTables") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
Loot Tables
|
||||
</a>
|
||||
|
||||
<a href="/admin/resistances" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Resistances") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/>
|
||||
</svg>
|
||||
Resistances
|
||||
</a>
|
||||
|
||||
<div class="pt-4">
|
||||
<p class="px-4 text-xs font-semibold text-gray-500 uppercase tracking-wider">Management</p>
|
||||
</div>
|
||||
|
||||
<a href="/admin/dungeons" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Dungeons") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
|
||||
</svg>
|
||||
Dungeons
|
||||
</a>
|
||||
|
||||
<a href="/admin/players" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Players") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/>
|
||||
</svg>
|
||||
Players
|
||||
</a>
|
||||
|
||||
<a href="/admin/server" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Server") == true ? "active" : "")" onclick="closeMobileMenu()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"/>
|
||||
</svg>
|
||||
Server
|
||||
<a href="/admin/server" class="sidebar-link @(ViewContext.RouteData.Values["page"]?.ToString()?.StartsWith("/Server") == true ? "active" : "")" data-tooltip="Server">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"/></svg>
|
||||
<span>Server</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<!-- User info -->
|
||||
<div class="p-4 border-t border-gray-700">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-full bg-indigo-600 flex items-center justify-center text-white font-bold">
|
||||
<div class="p-2 border-t border-gray-700">
|
||||
<div class="flex items-center gap-2 p-2">
|
||||
<div class="w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center text-white text-sm font-bold flex-shrink-0">
|
||||
@(ViewData["AdminUsername"]?.ToString()?.Substring(0, 1).ToUpper() ?? "A")
|
||||
</div>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="user-info flex-1 min-w-0">
|
||||
<p class="text-sm font-medium text-white truncate">@ViewData["AdminUsername"]</p>
|
||||
<p class="text-xs text-gray-400">@ViewData["AdminRole"]</p>
|
||||
</div>
|
||||
<a href="/admin/logout" class="text-gray-400 hover:text-white">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
|
||||
</svg>
|
||||
<a href="/admin/logout" class="text-gray-400 hover:text-white flex-shrink-0" title="Logout">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Main content -->
|
||||
<main class="flex-1 overflow-auto min-w-0">
|
||||
<!-- Mobile header -->
|
||||
<div class="lg:hidden sticky top-0 z-30 bg-gray-800 border-b border-gray-700 p-4 flex items-center gap-4">
|
||||
<div class="lg:hidden sticky top-0 z-30 bg-gray-800 border-b border-gray-700 p-3 flex items-center gap-3">
|
||||
<button class="mobile-menu-btn text-gray-400 hover:text-white" onclick="toggleDrawer()">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
|
||||
</svg>
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
|
||||
</button>
|
||||
<h1 class="text-lg font-semibold text-white truncate">@ViewData["Title"]</h1>
|
||||
</div>
|
||||
|
||||
<div class="p-4 md:p-6 lg:p-8">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<div class="p-4 md:p-6">@RenderBody()</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const SIDEBAR_KEY = 'sidebar_collapsed';
|
||||
function toggleSidebar() {
|
||||
const s = document.getElementById('sidebar');
|
||||
s.classList.toggle('collapsed');
|
||||
localStorage.setItem(SIDEBAR_KEY, s.classList.contains('collapsed'));
|
||||
}
|
||||
function toggleDrawer() {
|
||||
document.getElementById('sidebar').classList.toggle('open');
|
||||
document.getElementById('drawer-overlay').classList.toggle('open');
|
||||
document.body.classList.toggle('overflow-hidden');
|
||||
}
|
||||
|
||||
function closeMobileMenu() {
|
||||
if (window.innerWidth < 1024) {
|
||||
document.getElementById('sidebar').classList.remove('open');
|
||||
document.getElementById('drawer-overlay').classList.remove('open');
|
||||
document.body.classList.remove('overflow-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Close drawer on escape key
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
closeMobileMenu();
|
||||
}
|
||||
});
|
||||
|
||||
// Close drawer on window resize to desktop
|
||||
window.addEventListener('resize', function() {
|
||||
if (window.innerWidth >= 1024) {
|
||||
document.getElementById('sidebar').classList.remove('open');
|
||||
document.getElementById('drawer-overlay').classList.remove('open');
|
||||
document.body.classList.remove('overflow-hidden');
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (localStorage.getItem(SIDEBAR_KEY) === 'true') document.getElementById('sidebar').classList.add('collapsed');
|
||||
});
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') { document.getElementById('sidebar').classList.remove('open'); document.getElementById('drawer-overlay').classList.remove('open'); } });
|
||||
</script>
|
||||
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user