add contribution actions

This commit is contained in:
MathieuG-P
2022-10-17 01:10:43 +02:00
parent 9fbceb1fe4
commit 513aef87fc
9 changed files with 88 additions and 8 deletions
+8 -1
View File
@@ -89,7 +89,14 @@
"support": "Support BSManager",
"supporters":"Supporters 👀"
}
},
"contribution":{
"description":"Suggest new features or report a bug to help improve BSManager!",
"buttons":{
"request-features":"Request a feature",
"report-bug":"Report a bug",
"open-logs": "Open logs"
}
}
}
},
+9 -1
View File
@@ -89,8 +89,16 @@
"support": "Apoyo BSManager",
"supporters":"Apoyos 👀"
}
},
"contribution":{
"description":"¡Sugiera nuevas características o reporte un error para ayudar a mejorar BSManager!",
"buttons":{
"request-features":"Proponer una funcionalidad",
"report-bug":"Informar de un error",
"open-logs": "Abrir los registros"
}
}
}
}
},
"notifications":{
+8 -1
View File
@@ -89,7 +89,14 @@
"support": "Soutenir BSManager",
"supporters":"Supporteurs 👀"
}
},
"contribution":{
"description":"Propose de nouvelles fonctionnalités ou signale un bug pour contribuer à l'amélioration de BSManager !",
"buttons":{
"request-features":"Proposer une fonctionnalité",
"report-bug":"Signaler un bug",
"open-logs": "Ouvrir les logs"
}
}
}
},
+4
View File
@@ -48,3 +48,7 @@ ipcMain.on('save-file', async (event, request: IpcRequest<{filename?: string, fi
ipcMain.on("current-version", async (event, request: IpcRequest<void>) => {
UtilsService.getInstance().ipcSend(request.responceChannel, {success: true, data: app.getVersion()});
});
ipcMain.on("open-logs", async (event, request: IpcRequest<void>) => {
shell.openPath(app.getPath("logs"));
});
@@ -23,10 +23,11 @@ type propsType = {
onClickOutside?: (e: MouseEvent) => void,
onClick?: (e: React.MouseEvent) => void,
typeColor?:BsmButtonType,
color?: string
color?: string,
title?: string,
}
export function BsmButton({className, style, imgClassName, iconClassName, icon, image, text, type, active, withBar = true, disabled, onClickOutside, onClick, typeColor, color}: propsType) {
export function BsmButton({className, style, imgClassName, iconClassName, icon, image, text, type, active, withBar = true, disabled, onClickOutside, onClick, typeColor, color, title}: propsType) {
const t = useTranslation();
const secondColor = useThemeColor("second-color");
@@ -49,7 +50,7 @@ export function BsmButton({className, style, imgClassName, iconClassName, icon,
return (
<OutsideClickHandler onOutsideClick={e => onClickOutside && onClickOutside(e)}>
<div onClick={onClick} className={`${className} overflow-hidden cursor-pointer group ${(!withBar && !disabled && (!!typeColor || !!color)) && "hover:brightness-[1.15]"} ${disabled && "brightness-75 cursor-not-allowed"} ${renderTypeColor}`} style={{...style, backgroundColor: primaryColor || color}}>
<div onClick={onClick} title={t(title)} className={`${className} overflow-hidden cursor-pointer group ${(!withBar && !disabled && (!!typeColor || !!color)) && "hover:brightness-[1.15]"} ${disabled && "brightness-75 cursor-not-allowed"} ${renderTypeColor}`} style={{...style, backgroundColor: primaryColor || color}}>
{ image && <BsmImage image={image} className={imgClassName}/> }
{ icon && <BsmIcon icon={icon} className={iconClassName ?? "h-full w-full text-gray-800 dark:text-white"}/> }
{text && (type === "submit" ? <button type="submit" className="w-full h-full" style={{...(!!textColor && {color: textColor})}}>{t(text)}</button> : <span style={{...(!!textColor && {color: `${textColor}`})}}>{t(text)}</span>)}
@@ -22,10 +22,11 @@ import PatreonIcon from "./icons/patreon-icon.component";
import { SearchIcon } from "./icons/search-icon.component";
import { CheckIcon } from "./icons/check-icon.component";
import { ThreeDotsIcon } from "./icons/three-dots-icon.component";
import { GitHubIcon } from "./icons/github-icon.component";
export type BsmIconType = (
"settings"|"trash"|"favorite"|"folder"|"bsNote"|"check"|"three-dots"|
"terminal"|"desktop"|"oculus"|"add"|"cross"|"task"|
"terminal"|"desktop"|"oculus"|"add"|"cross"|"task"|"github"|
"copy"|"steam"|"edit"|"export"|"patreon"|"search"|
"fr-FR-flag"|"es-ES-flag"|"en-US-flag"|"en-EN-flag"
);
@@ -56,6 +57,7 @@ export const BsmIcon = memo(({className, icon, style}: {className?: string, icon
if(icon === "search"){ return <SearchIcon className={className} style={style}/> }
if(icon === "check"){ return <CheckIcon className={className} style={style}/> }
if(icon === "three-dots"){ return <ThreeDotsIcon className={className} style={style}/> }
if(icon === "github"){ return <GitHubIcon className={className} style={style}/> }
return <TrashIcon className={className} style={style}/>
}
@@ -0,0 +1,9 @@
import { CSSProperties } from 'react'
export function GitHubIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg className={props.className} style={props.style} viewBox="0 0 16 16" width="16" height="16">
<path fill="currentColor" fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
</svg>
)
}
+21 -1
View File
@@ -17,6 +17,7 @@ import { NotificationService } from "renderer/services/notification.service";
import { ProgressBarService } from "renderer/services/progress-bar.service";
import { ThemeService } from "renderer/services/theme.service";
import { SupportersView } from "renderer/components/settings/supporters-view/supporters-view.component";
import { LinkOpenerService } from "renderer/services/link-opener.service";
export function SettingsPage() {
@@ -29,6 +30,7 @@ export function SettingsPage() {
const authService: AuthUserService = AuthUserService.getInstance();
const notificationService: NotificationService = NotificationService.getInstance();
const i18nService: I18nService = I18nService.getInstance();
const linkOpener: LinkOpenerService = LinkOpenerService.getInstance();
const {firstColor, secondColor} = useThemeColor();
const sessionExist = useObservable(authService.sessionExist$);
@@ -111,13 +113,19 @@ export function SettingsPage() {
};
const openPatreonPage = () => {
ipcService.sendLazy("new-window", {args: "https://www.patreon.com/bsmanager?fan_landing=true"})
linkOpener.open("https://www.patreon.com/bsmanager?fan_landing=true");
}
const toogleShowSupporters = () => {
setShowSupporters(show => !show);
}
const openGithub = () => linkOpener.open("https://github.com/Zagrios/bs-manager");
const openReportBug = () => linkOpener.open("https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=bug&template=bug_report.md&title=%5BBUG%5D");
const openRequestFeatures = () => linkOpener.open("https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=enhancement&template=feature_request.md&title=%5BAME%5D");
const openLogs = () => ipcService.sendLazy("open-logs");
return (
<div className="w-full h-full flex justify-center overflow-y-scroll scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900 text-gray-800 dark:text-gray-200">
@@ -156,6 +164,18 @@ export function SettingsPage() {
<BsmButton className="flex w-fit rounded-md h-8 px-2 font-bold py-1 whitespace-nowrap mr-2 !text-white" iconClassName="mr-1" text="pages.settings.patreon.buttons.support" icon="patreon" color="#EC6350" withBar={false} onClick={openPatreonPage}/>
<BsmButton className="flex w-fit rounded-md h-8 px-2 font-bold py-1 !text-white" withBar={false} text="pages.settings.patreon.buttons.supporters" color="#6c5ce7" onClick={toogleShowSupporters}/>
</div>
<SettingContainer className="pt-3" description="pages.settings.contribution.description">
<div className="flex items-center justify-between w-full h-8 bg-light-main-color-1 dark:bg-main-color-1 rounded-md pl-2 py-1">
<div className="flex">
<BsmButton onClick={openRequestFeatures} className="shrink-0 whitespace-nowrap mr-2 px-2 font-bold italic text-sm rounded-md" text="pages.settings.contribution.buttons.request-features" withBar={false}/>
<BsmButton onClick={openReportBug} className="shrink-0 whitespace-nowrap mr-2 px-2 font-bold italic text-sm rounded-md" text="pages.settings.contribution.buttons.report-bug" withBar={false}/>
</div>
<div className="flex">
<BsmButton onClick={openLogs} className="shrink-0 whitespace-nowrap mr-2 px-2 font-bold italic text-sm rounded-md" text="pages.settings.contribution.buttons.open-logs" withBar={false}/>
<BsmButton onClick={openGithub} className="h-full shrink-0 whitespace-nowrap mr-2 px-2 font-bold italic text-sm rounded-md" icon="github" title="GitHub" withBar={false}/>
</div>
</div>
</SettingContainer>
</SettingContainer>
<span className="bg-light-main-color-1 dark:bg-main-color-1 rounded-md py-1 px-2 font-bold float-right">v{appVersion}</span>
@@ -0,0 +1,22 @@
import { IpcService } from "./ipc.service";
export class LinkOpenerService{
private static instance: LinkOpenerService;
private readonly ipcService: IpcService
public static getInstance(): LinkOpenerService{
if(!LinkOpenerService.instance){ LinkOpenerService.instance = new LinkOpenerService(); }
return LinkOpenerService.instance;
}
private constructor(){
this.ipcService = IpcService.getInstance();
}
public open(url: string): void{
this.ipcService.sendLazy("new-window", {args: url});
}
}