xccxv
All checks were successful
Deploy / deploy (push) Successful in 51s

This commit is contained in:
2026-07-24 21:09:33 +02:00
parent 5256dd4080
commit 5630ff2308
12 changed files with 139 additions and 29 deletions

View File

@@ -345,11 +345,14 @@ final class AccountPages
'avatar_beard_style' => 'none',
'avatar_glasses_style' => 'none',
'avatar_head_shape' => 'round',
'avatar_hat_style' => 'none',
'avatar_hat_color' => 'navy',
'avatar_outfit_color' => 'slate',
];
if ($profileSettings) {
$profileSettings->ensureSchema();
}
$stmt = $pdo?->prepare('SELECT u.email, u.status, p.display_name, p.first_name, p.last_name, p.zip, p.city, p.profession, p.languages, p.about, p.contact_phone, p.location_tracking_preference, p.avatar_skin_tone, p.avatar_hair_style, p.avatar_hair_color, p.avatar_eye_color, p.avatar_beard_style, p.avatar_glasses_style, p.avatar_head_shape FROM users u LEFT JOIN user_profiles p ON p.user_id = u.id WHERE u.id = :id LIMIT 1');
$stmt = $pdo?->prepare('SELECT u.email, u.status, p.display_name, p.first_name, p.last_name, p.zip, p.city, p.profession, p.languages, p.about, p.contact_phone, p.location_tracking_preference, p.avatar_skin_tone, p.avatar_hair_style, p.avatar_hair_color, p.avatar_eye_color, p.avatar_beard_style, p.avatar_glasses_style, p.avatar_head_shape, p.avatar_hat_style, p.avatar_hat_color, p.avatar_outfit_color FROM users u LEFT JOIN user_profiles p ON p.user_id = u.id WHERE u.id = :id LIMIT 1');
$stmt?->execute(['id' => $userId]);
$row = $stmt?->fetch(\PDO::FETCH_ASSOC);
if ($row) {

View File

@@ -15,6 +15,9 @@ final class Avatar
'avatar_beard_style' => 'none',
'avatar_glasses_style' => 'none',
'avatar_head_shape' => 'round',
'avatar_hat_style' => 'none',
'avatar_hat_color' => 'navy',
'avatar_outfit_color' => 'slate',
];
}
@@ -30,8 +33,10 @@ final class Avatar
],
'avatar_hair_style' => [
'short' => 'Kurz',
'fade' => 'Fade',
'parted' => 'Seitlich',
'curly' => 'Lockig',
'waves' => 'Wellen',
'bald' => 'Kahl',
],
'avatar_hair_color' => [
@@ -63,6 +68,25 @@ final class Avatar
'oval' => 'Oval',
'square' => 'Eckig',
],
'avatar_hat_style' => [
'none' => 'Ohne',
'beanie' => 'Beanie',
'cap' => 'Cap',
],
'avatar_hat_color' => [
'navy' => ['label' => 'Navy', 'color' => '#38475f'],
'charcoal' => ['label' => 'Anthrazit', 'color' => '#3c3f45'],
'forest' => ['label' => 'Waldgrün', 'color' => '#48614d'],
'brick' => ['label' => 'Ziegel', 'color' => '#975244'],
'sand' => ['label' => 'Sand', 'color' => '#b79e79'],
],
'avatar_outfit_color' => [
'slate' => ['label' => 'Schiefer', 'color' => '#5f7387'],
'graphite' => ['label' => 'Graphit', 'color' => '#4c515a'],
'olive' => ['label' => 'Oliv', 'color' => '#667155'],
'rust' => ['label' => 'Rost', 'color' => '#9f6547'],
'ocean' => ['label' => 'Ozean', 'color' => '#4e7897'],
],
];
}
@@ -100,6 +124,8 @@ final class Avatar
$skin = $options['avatar_skin_tone'][$avatar['avatar_skin_tone']]['color'];
$hair = $options['avatar_hair_color'][$avatar['avatar_hair_color']]['color'];
$eyes = $options['avatar_eye_color'][$avatar['avatar_eye_color']]['color'];
$hat = $options['avatar_hat_color'][$avatar['avatar_hat_color']]['color'];
$outfit = $options['avatar_outfit_color'][$avatar['avatar_outfit_color']]['color'];
$classes = [
'pkt-avatar',
@@ -108,13 +134,16 @@ final class Avatar
'pkt-avatar--hair-' . $avatar['avatar_hair_style'],
'pkt-avatar--beard-' . $avatar['avatar_beard_style'],
'pkt-avatar--glasses-' . $avatar['avatar_glasses_style'],
'pkt-avatar--hat-' . $avatar['avatar_hat_style'],
];
$style = sprintf(
'--avatar-skin:%s;--avatar-hair:%s;--avatar-eye:%s;',
'--avatar-skin:%s;--avatar-hair:%s;--avatar-eye:%s;--avatar-hat:%s;--avatar-outfit:%s;',
$skin,
$hair,
$eyes
$eyes,
$hat,
$outfit
);
$label = htmlspecialchars('Avatar von ' . $name, ENT_QUOTES);
@@ -122,13 +151,19 @@ final class Avatar
return sprintf(
'<span class="%s" style="%s" role="img" aria-label="%s">' .
'<span class="pkt-avatar__bg"></span>' .
'<span class="pkt-avatar__shirt"></span>' .
'<span class="pkt-avatar__shadow"></span>' .
'<span class="pkt-avatar__hoodie"></span>' .
'<span class="pkt-avatar__neck"></span>' .
'<span class="pkt-avatar__ears"></span>' .
'<span class="pkt-avatar__head"></span>' .
'<span class="pkt-avatar__cheek pkt-avatar__cheek--left"></span>' .
'<span class="pkt-avatar__cheek pkt-avatar__cheek--right"></span>' .
'<span class="pkt-avatar__hair"></span>' .
'<span class="pkt-avatar__hat"></span>' .
'<span class="pkt-avatar__eye pkt-avatar__eye--left"></span>' .
'<span class="pkt-avatar__eye pkt-avatar__eye--right"></span>' .
'<span class="pkt-avatar__brow pkt-avatar__brow--left"></span>' .
'<span class="pkt-avatar__brow pkt-avatar__brow--right"></span>' .
'<span class="pkt-avatar__nose"></span>' .
'<span class="pkt-avatar__mouth"></span>' .
'<span class="pkt-avatar__beard"></span>' .

View File

@@ -150,7 +150,7 @@ final class Community
$where = $conditions ? ('AND ' . implode(' AND ', $conditions)) : '';
$avatarSelect = $this->hasColumn('user_profiles', 'avatar_skin_tone')
$avatarSelect = $this->hasColumn('user_profiles', 'avatar_outfit_color')
? ', ' . Avatar::selectColumns('p')
: '';
$sql = "SELECT ft.id, ft.title, ft.body, ft.created_at, ft.updated_at,
@@ -206,7 +206,7 @@ final class Community
public function getThread(int $id): ?array
{
$select = 'ft.*, p.display_name';
if ($this->hasColumn('user_profiles', 'avatar_skin_tone')) {
if ($this->hasColumn('user_profiles', 'avatar_outfit_color')) {
$select .= ', ' . Avatar::selectColumns('p');
}
$join = '';
@@ -226,7 +226,7 @@ final class Community
public function listPosts(int $threadId): array
{
$select = 'fp.*, p.display_name';
if ($this->hasColumn('user_profiles', 'avatar_skin_tone')) {
if ($this->hasColumn('user_profiles', 'avatar_outfit_color')) {
$select .= ', ' . Avatar::selectColumns('p');
}
if ($this->hasColumn('forum_posts', 'highlighted_at')) {

View File

@@ -36,6 +36,9 @@ final class ProfileSettings
'avatar_beard_style' => "ALTER TABLE user_profiles ADD COLUMN avatar_beard_style VARCHAR(24) NOT NULL DEFAULT 'none' AFTER avatar_eye_color",
'avatar_glasses_style' => "ALTER TABLE user_profiles ADD COLUMN avatar_glasses_style VARCHAR(24) NOT NULL DEFAULT 'none' AFTER avatar_beard_style",
'avatar_head_shape' => "ALTER TABLE user_profiles ADD COLUMN avatar_head_shape VARCHAR(24) NOT NULL DEFAULT 'round' AFTER avatar_glasses_style",
'avatar_hat_style' => "ALTER TABLE user_profiles ADD COLUMN avatar_hat_style VARCHAR(24) NOT NULL DEFAULT 'none' AFTER avatar_head_shape",
'avatar_hat_color' => "ALTER TABLE user_profiles ADD COLUMN avatar_hat_color VARCHAR(24) NOT NULL DEFAULT 'navy' AFTER avatar_hat_style",
'avatar_outfit_color' => "ALTER TABLE user_profiles ADD COLUMN avatar_outfit_color VARCHAR(24) NOT NULL DEFAULT 'slate' AFTER avatar_hat_color",
];
foreach ($avatarColumns as $column => $sql) {
if (!$this->hasColumn('user_profiles', $column)) {
@@ -92,6 +95,9 @@ final class ProfileSettings
avatar_beard_style = :beardStyle,
avatar_glasses_style = :glassesStyle,
avatar_head_shape = :headShape,
avatar_hat_style = :hatStyle,
avatar_hat_color = :hatColor,
avatar_outfit_color = :outfitColor,
updated_at = NOW()
WHERE user_id = :id'
);
@@ -103,6 +109,9 @@ final class ProfileSettings
'beardStyle' => $avatar['avatar_beard_style'],
'glassesStyle' => $avatar['avatar_glasses_style'],
'headShape' => $avatar['avatar_head_shape'],
'hatStyle' => $avatar['avatar_hat_style'],
'hatColor' => $avatar['avatar_hat_color'],
'outfitColor' => $avatar['avatar_outfit_color'],
'id' => $userId,
]);
}