Skip to content

Commit

Permalink
feat: stream card options and other improvements (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nether0ne authored Dec 25, 2022
1 parent 1799221 commit eba2d44
Show file tree
Hide file tree
Showing 32 changed files with 819 additions and 185 deletions.
70 changes: 70 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"coinbase": {
"message": "Coinbase"
},
"paypal": {
"message": "Paypal"
},
"generalSettings": {
"message": "General settings"
},
Expand Down Expand Up @@ -90,6 +93,27 @@
"badge": {
"message": "Display badge on browser icon"
},
"customStreamCard": {
"message": "Custom stream card settings"
},
"useCustomStreamCard": {
"message": "Use custom stream card settings"
},
"useCustomThumbnail": {
"message": "Stream thumbnail"
},
"useCustomPlatformIcon": {
"message": "Stream platform icon"
},
"useCustomViewers": {
"message": "Stream current viewers"
},
"useCustomTitle": {
"message": "Stream title"
},
"useCustomCategory": {
"message": "Stream category"
},
"twitch": {
"message": "Twitch"
},
Expand Down Expand Up @@ -275,6 +299,22 @@
"search": {
"message": "Search"
},
"asc": {
"message": "Sorted by $type$ ascending",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"desc": {
"message": "Sorted by $type$ descending",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"viewersSortField": {
"message": "Viewers"
},
Expand All @@ -284,6 +324,14 @@
"userSortField": {
"message": "Name"
},
"groupedBy": {
"message": "Streams are grouped by $group$",
"placeholders": {
"group": {
"content": "$1"
}
}
},
"noneGroupBy": {
"message": "None"
},
Expand All @@ -302,6 +350,9 @@
"rerun": {
"message": "Rerun"
},
"noCategory": {
"message": "No category"
},
"openStream": {
"message": "Open stream"
},
Expand Down Expand Up @@ -387,5 +438,24 @@
},
"backgroundResetButton": {
"message": "Reset application"
},
"accessTokenExpired": {
"message": "$platform$ access token has expired",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"renewAcessToken": {
"message": "Renew $platform$ access token",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"forbidPlatform": {
"message": "Remove platform"
}
}
70 changes: 70 additions & 0 deletions public/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"coinbase": {
"message": "Coinbase"
},
"paypal": {
"message": "Paypal"
},
"generalSettings": {
"message": "Главные настройки"
},
Expand Down Expand Up @@ -90,6 +93,27 @@
"badge": {
"message": "Показывать значок с количеством активных стримов"
},
"customStreamCard": {
"message": "Собственные настройки карточки стрима"
},
"useCustomStreamCard": {
"message": "Использовать собственные настройки карточки стрима"
},
"useCustomThumbnail": {
"message": "Миниатюра стрима"
},
"useCustomPlatformIcon": {
"message": "Иконка платформы стрима"
},
"useCustomViewers": {
"message": "Количество зрителей стрима"
},
"useCustomTitle": {
"message": "Название стрима"
},
"useCustomCategory": {
"message": "Категория стрима"
},
"twitch": {
"message": "Twitch"
},
Expand Down Expand Up @@ -275,6 +299,22 @@
"search": {
"message": "Поиск"
},
"asc": {
"message": "Отсортировано за {type} по возростанию",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"desc": {
"message": "Отсортировано за {type} по убыванию",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"viewersSortField": {
"message": "Зрители"
},
Expand All @@ -284,6 +324,14 @@
"userSortField": {
"message": "Имя"
},
"groupedBy": {
"message": "Стримы сгрупированны как $group$",
"placeholders": {
"group": {
"content": "$1"
}
}
},
"noneGroupBy": {
"message": "Отсутствует"
},
Expand All @@ -302,6 +350,9 @@
"rerun": {
"message": "Повтор"
},
"noCategory": {
"message": "Без категории"
},
"openStream": {
"message": "Открыть стрим"
},
Expand Down Expand Up @@ -387,5 +438,24 @@
},
"backgroundResetButton": {
"message": "Перезапустить приложение"
},
"accessTokenExpired": {
"message": "Токен доступа $platform$ истек",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"renewAcessToken": {
"message": "Обновить токен доступа $platform$",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"forbidPlatform": {
"message": "Убрать платформу"
}
}
70 changes: 70 additions & 0 deletions public/_locales/uk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"coinbase": {
"message": "Coinbase"
},
"paypal": {
"message": "Paypal"
},
"generalSettings": {
"message": "Основні налаштування"
},
Expand Down Expand Up @@ -90,6 +93,27 @@
"badge": {
"message": "Відображати значок з кількістю активних каналів"
},
"customStreamCard": {
"message": "Власні налаштування картки трансляції"
},
"useCustomStreamCard": {
"message": "Використовувати власні налаштування картки трансляції"
},
"useCustomThumbnail": {
"message": "Мініатюра трансляції"
},
"useCustomPlatformIcon": {
"message": "Іконка платформи трансляції"
},
"useCustomViewers": {
"message": "Кількість глядачів трансляції"
},
"useCustomTitle": {
"message": "Назва трансляції"
},
"useCustomCategory": {
"message": "Категорія трансляції"
},
"twitch": {
"message": "Twitch"
},
Expand Down Expand Up @@ -275,6 +299,22 @@
"search": {
"message": "Пошук"
},
"asc": {
"message": "Відсортовано за {type} по зростанню",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"desc": {
"message": "Відсортовано за {type} по спаданню",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"viewersSortField": {
"message": "Глядачі"
},
Expand All @@ -284,6 +324,14 @@
"userSortField": {
"message": "Ім'я"
},
"groupedBy": {
"message": "Трансляції згруповані як $group$",
"placeholders": {
"group": {
"content": "$1"
}
}
},
"noneGroupBy": {
"message": "Немає"
},
Expand All @@ -302,6 +350,9 @@
"rerun": {
"message": "Повтор"
},
"noCategory": {
"message": "Без категорії"
},
"openStream": {
"message": "Відкрити стрим"
},
Expand Down Expand Up @@ -387,5 +438,24 @@
},
"backgroundResetButton": {
"message": "Перезапустити застосунок"
},
"accessTokenExpired": {
"message": "Токен доступу $platform$ застарів",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"renewAcessToken": {
"message": "Оновити токен $platform$",
"placeholders": {
"platform": {
"content": "$1"
}
}
},
"forbidPlatform": {
"message": "Видалити платформу"
}
}
1 change: 0 additions & 1 deletion src/background/actions/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export async function setupPlatform(
platform.enabled = true;
platform.accessToken = accessToken;
await stores[`${platform.name}`].set(platform);
console.log(platform);
return await updatePlatform(platform);
}

Expand Down
4 changes: 2 additions & 2 deletions src/background/actions/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const newStreamNotification = async (

createNotification([NotificationType.STREAM, JSON.stringify(stream)], {
title: t("streamerOnline", [user, platform]),
message: game ?? "",
message: game ?? t("noCategory"),
contextMessage: title,
type: "basic",
iconUrl: icon,
Expand All @@ -127,7 +127,7 @@ const newCategoryNotification = async (
if (oldStream.game !== game) {
createNotification([NotificationType.STREAM, JSON.stringify(newStream)], {
title: t("streamerNewCategory", user),
message: t("streamerNewCategoryMessage", [oldStream.game, game]),
message: t("streamerNewCategoryMessage", [oldStream.game, game || t("noCategory")]),
contextMessage: title,
type: "basic",
iconUrl: icon,
Expand Down
9 changes: 9 additions & 0 deletions src/browser/common/hooks/platform.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { stores } from "@/common/store";
import { PlatformName } from "@/common/types/platform";
import { get } from "lodash-es";
import { useMemo } from "react";
import { useStore } from "./store";

export function usePlatform(name: PlatformName) {
Expand All @@ -18,3 +19,11 @@ export function useAllSetPlatforms() {

return allSetProfiles;
}

export function useAllExpiredPlatforms() {
const [twitch] = usePlatform(PlatformName.TWITCH);

return useMemo(() => {
return twitch.accessToken === undefined && twitch.enabled ? twitch : null;
}, [twitch]);
}
Loading

0 comments on commit eba2d44

Please sign in to comment.