Auto commit: 2025-11-25T15:11:21.393Z
This commit is contained in:
parent
2182af8342
commit
a89cf28635
@ -67,3 +67,24 @@ body {
|
|||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stats-card {
|
||||||
|
background-color: #18181B;
|
||||||
|
border: 1px solid #2A2A2E;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
transition: transform 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-card:hover {
|
||||||
|
transform: scale(1.03);
|
||||||
|
border-color: #9146FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-card .card-title {
|
||||||
|
color: #ADADB8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-card .card-text {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,37 @@
|
|||||||
// Future JavaScript for interactivity
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
console.log('Twitch Dashboard Ready');
|
console.log('Twitch Dashboard Ready');
|
||||||
|
|
||||||
|
const searchBar = document.getElementById('search-bar');
|
||||||
|
if (searchBar) {
|
||||||
|
searchBar.addEventListener('keyup', function(e) {
|
||||||
|
const term = e.target.value.toLowerCase();
|
||||||
|
|
||||||
|
// Filter Top Games
|
||||||
|
const gameCards = document.querySelectorAll('.game-card');
|
||||||
|
gameCards.forEach(card => {
|
||||||
|
const title = card.querySelector('.card-title').textContent.toLowerCase();
|
||||||
|
const tags = Array.from(card.querySelectorAll('.badge-genre')).map(tag => tag.textContent.toLowerCase());
|
||||||
|
if (title.includes(term) || tags.some(tag => tag.includes(term))) {
|
||||||
|
card.parentElement.style.display = '';
|
||||||
|
} else {
|
||||||
|
card.parentElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filter Live Channels
|
||||||
|
const channelCards = document.querySelectorAll('.channel-card');
|
||||||
|
channelCards.forEach(card => {
|
||||||
|
const name = card.querySelector('.card-title').textContent.toLowerCase();
|
||||||
|
const game = card.querySelector('.card-text.small').textContent.toLowerCase();
|
||||||
|
const title = card.querySelector('.card-text.text-white-50').textContent.toLowerCase();
|
||||||
|
const tags = Array.from(card.querySelectorAll('.badge-genre')).map(tag => tag.textContent.toLowerCase());
|
||||||
|
|
||||||
|
if (name.includes(term) || game.includes(term) || title.includes(term) || tags.some(tag => tag.includes(term))) {
|
||||||
|
card.parentElement.style.display = '';
|
||||||
|
} else {
|
||||||
|
card.parentElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
139
index.php
139
index.php
@ -3,57 +3,119 @@
|
|||||||
$top_games = [
|
$top_games = [
|
||||||
[
|
[
|
||||||
'title' => 'Just Chatting',
|
'title' => 'Just Chatting',
|
||||||
'viewers' => '350K',
|
'viewers' => '480K',
|
||||||
'tags' => ['IRL'],
|
'tags' => ['IRL', 'Casual'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/509658-285x380.jpg'
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/509658-285x380.jpg'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'title' => 'League of Legends',
|
'title' => 'League of Legends',
|
||||||
'viewers' => '125K',
|
'viewers' => '210K',
|
||||||
'tags' => ['MOBA', 'Action'],
|
'tags' => ['MOBA', 'Action', 'Strategy'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/21779-285x380.jpg'
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/21779-285x380.jpg'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'title' => 'VALORANT',
|
'title' => 'VALORANT',
|
||||||
'viewers' => '98K',
|
'viewers' => '150K',
|
||||||
'tags' => ['FPS', 'Shooter'],
|
'tags' => ['FPS', 'Shooter', 'Tactical'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/516575-285x380.jpg'
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/516575-285x380.jpg'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'title' => 'Grand Theft Auto V',
|
'title' => 'Grand Theft Auto V',
|
||||||
'viewers' => '88K',
|
'viewers' => '120K',
|
||||||
'tags' => ['Adventure'],
|
'tags' => ['Adventure', 'Open World'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/32982_IGDB-285x380.jpg'
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/32982_IGDB-285x380.jpg'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Fortnite',
|
||||||
|
'viewers' => '110K',
|
||||||
|
'tags' => ['Battle Royale', 'Shooter'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/33214-285x380.jpg'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Counter-Strike 2',
|
||||||
|
'viewers' => '95K',
|
||||||
|
'tags' => ['FPS', 'Tactical', 'Shooter'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/1812225397_IGDB-285x380.jpg'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'World of Warcraft',
|
||||||
|
'viewers' => '80K',
|
||||||
|
'tags' => ['MMORPG', 'RPG'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/18122-285x380.jpg'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Dota 2',
|
||||||
|
'viewers' => '75K',
|
||||||
|
'tags' => ['MOBA', 'Strategy'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/ttv-boxart/29595-285x380.jpg'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$live_channels = [
|
$live_channels = [
|
||||||
[
|
[
|
||||||
'name' => 'xQc',
|
'name' => 'xQc',
|
||||||
'game' => 'Just Chatting',
|
'game' => 'Just Chatting',
|
||||||
'viewers' => '78K',
|
'title' => 'RANKED GRIND! | !socials',
|
||||||
|
'viewers' => '98K',
|
||||||
|
'tags' => ['Competitive', 'English'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/xqc-profile_image-9298d2877057642a-70x70.png'
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/xqc-profile_image-9298d2877057642a-70x70.png'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Tarik',
|
'name' => 'Tarik',
|
||||||
'game' => 'VALORANT',
|
'game' => 'VALORANT',
|
||||||
'viewers' => '45K',
|
'title' => 'Vibing and Winning | #1 Radiant',
|
||||||
|
'viewers' => '65K',
|
||||||
|
'tags' => ['FPS', 'Pro Player'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/tarik-profile_image-d6f82a69354da623-70x70.png'
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/tarik-profile_image-d6f82a69354da623-70x70.png'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'summit1g',
|
'name' => 'summit1g',
|
||||||
'game' => 'Old School RuneScape',
|
'game' => 'Old School RuneScape',
|
||||||
'viewers' => '21K',
|
'title' => 'Maxing my account! | !drops',
|
||||||
|
'viewers' => '31K',
|
||||||
|
'tags' => ['MMORPG', 'Grinding'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/summit1g-profile_image-d29b89b15533818c-70x70.png'
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/summit1g-profile_image-d29b89b15533818c-70x70.png'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'LIRIK',
|
'name' => 'LIRIK',
|
||||||
'game' => 'DayZ',
|
'game' => 'DayZ',
|
||||||
'viewers' => '15K',
|
'title' => 'SURVIVAL RP | !newvideo',
|
||||||
|
'viewers' => '25K',
|
||||||
|
'tags' => ['Survival', 'Funny Moments'],
|
||||||
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/lirik-profile_image-4ac8c3250307d433-70x70.png'
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/lirik-profile_image-4ac8c3250307d433-70x70.png'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Shroud',
|
||||||
|
'game' => 'Counter-Strike 2',
|
||||||
|
'title' => 'Aim training and pro plays',
|
||||||
|
'viewers' => '40K',
|
||||||
|
'tags' => ['FPS', 'Pro'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/shroud-profile_image-8839d8f9052f83ca-70x70.png'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Pokimane',
|
||||||
|
'game' => 'Just Chatting',
|
||||||
|
'title' => 'Chill stream and Q&A',
|
||||||
|
'viewers' => '35K',
|
||||||
|
'tags' => ['IRL', 'Community'],
|
||||||
|
'img' => 'https://static-cdn.jtvnw.net/jtv_user_pictures/pokimane-profile_image-9332cf5d27f13321-70x70.png'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Calculate statistics
|
||||||
|
$total_viewers = 0;
|
||||||
|
foreach ($live_channels as $channel) {
|
||||||
|
$viewers = str_replace('K', '000', $channel['viewers']);
|
||||||
|
$total_viewers += (int)$viewers;
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_live_channels = count($live_channels);
|
||||||
|
|
||||||
|
$top_category = '-';
|
||||||
|
if (!empty($top_games)) {
|
||||||
|
$top_category = $top_games[0]['title'];
|
||||||
|
}
|
||||||
|
|
||||||
// Read project preview data from environment
|
// Read project preview data from environment
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Twitch.TV Statistics Dashboard';
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Twitch.TV Statistics Dashboard';
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
@ -105,11 +167,44 @@ $projectName = $_SERVER['PROJECT_NAME'] ?? 'Twitch Stats';
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main class="container my-5">
|
<main class="container my-5">
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col">
|
||||||
|
<input type="text" id="search-bar" class="form-control" placeholder="Search for games and channels...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h1 class="mb-4">Dashboard Analytics</h1>
|
||||||
|
<div class="row g-4 mb-5">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 stats-card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<h5 class="card-title"><i class="fas fa-users"></i> Total Viewers</h5>
|
||||||
|
<p class="card-text display-4"><?= htmlspecialchars(number_format($total_viewers)) ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 stats-card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<h5 class="card-title"><i class="fas fa-video"></i> Total Live Channels</h5>
|
||||||
|
<p class="card-text display-4"><?= htmlspecialchars($total_live_channels) ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 stats-card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<h5 class="card-title"><i class="fas fa-gamepad"></i> Top Category</h5>
|
||||||
|
<p class="card-text display-4"><?= htmlspecialchars($top_category) ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1 class="mb-4">Top Categories</h1>
|
<h1 class="mb-4">Top Categories</h1>
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<?php foreach ($top_games as $game): ?>
|
<?php foreach ($top_games as $game): ?>
|
||||||
<div class="col-6 col-md-4 col-lg-3">
|
<div class="col-6 col-md-4 col-lg-3">
|
||||||
<div class="card h-100">
|
<div class="card h-100 game-card">
|
||||||
<img src="<?= htmlspecialchars($game['img']) ?>" class="card-img-top" alt="<?= htmlspecialchars($game['title']) ?>">
|
<img src="<?= htmlspecialchars($game['img']) ?>" class="card-img-top" alt="<?= htmlspecialchars($game['title']) ?>">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title mb-1"><?= htmlspecialchars($game['title']) ?></h5>
|
<h5 class="card-title mb-1"><?= htmlspecialchars($game['title']) ?></h5>
|
||||||
@ -126,20 +221,28 @@ $projectName = $_SERVER['PROJECT_NAME'] ?? 'Twitch Stats';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1 class="my-4 pt-4">Recommended Live Channels</h1>
|
<h1 class="my-4 pt-4">Recommended Live Channels</h1>
|
||||||
<div class="row g-3">
|
<div class="row g-4">
|
||||||
<?php foreach ($live_channels as $channel): ?>
|
<?php foreach ($live_channels as $channel): ?>
|
||||||
<div class="col-12 col-md-6 col-lg-4">
|
<div class="col-12 col-md-6 col-lg-4">
|
||||||
<div class="card">
|
<div class="card h-100 channel-card">
|
||||||
<div class="card-body d-flex align-items-center">
|
<div class="card-body d-flex">
|
||||||
<img src="<?= htmlspecialchars($channel['img']) ?>" class="rounded-circle me-3" alt="<?= htmlspecialchars($channel['name']) ?>" width="60" height="60">
|
<img src="<?= htmlspecialchars($channel['img']) ?>" class="rounded-circle me-3" alt="<?= htmlspecialchars($channel['name']) ?>" width="60" height="60">
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
<h5 class="card-title mb-0"><?= htmlspecialchars($channel['name']) ?></h5>
|
<h5 class="card-title mb-0"><?= htmlspecialchars($channel['name']) ?></h5>
|
||||||
<p class="card-text mb-1"><?= htmlspecialchars($channel['game']) ?></p>
|
|
||||||
</div>
|
|
||||||
<div class="viewers text-end">
|
<div class="viewers text-end">
|
||||||
<i class="fas fa-circle icon"></i> <?= htmlspecialchars($channel['viewers']) ?>
|
<i class="fas fa-circle icon"></i> <?= htmlspecialchars($channel['viewers']) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="card-text text-white-50 mb-1" title="<?= htmlspecialchars($channel['title']) ?>"><?= htmlspecialchars($channel['title']) ?></p>
|
||||||
|
<p class="card-text small mb-2"><?= htmlspecialchars($channel['game']) ?></p>
|
||||||
|
<div>
|
||||||
|
<?php foreach ($channel['tags'] as $tag): ?>
|
||||||
|
<span class="badge rounded-pill badge-genre"><?= htmlspecialchars($tag) ?></span>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user