Skip to content
This repository was archived by the owner on Feb 28, 2026. It is now read-only.

Commit b881710

Browse files
committed
Flatpak warning banner
1 parent 2aa3ff7 commit b881710

File tree

7 files changed

+74
-2
lines changed

7 files changed

+74
-2
lines changed

packages/i18n/src/locales/en_US.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@
196196
"updater": {
197197
"updateAvailable": "Update available"
198198
},
199+
"flatpak": {
200+
"sandboxWarning": "You're running Nuclear in a Flatpak sandbox. Some features may not work correctly. If you experience issues, try the .deb or AppImage instead.",
201+
"dismiss": "Got it"
202+
},
199203
"settings": {
200204
"title": "Settings",
201205
"categories": {

packages/player/src-tauri/src/commands.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ use std::path::{Path, PathBuf};
44
use tauri::command;
55
use zip::ZipArchive;
66

7+
#[command]
8+
pub fn is_flatpak() -> bool {
9+
std::env::var("FLATPAK_ID").is_ok()
10+
}
11+
712
#[command]
813
pub fn copy_dir_recursive(from: PathBuf, to: PathBuf) -> Result<(), String> {
914
fn inner(from: &Path, to: &Path) -> Result<(), std::io::Error> {

packages/player/src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub fn run() {
2626
stream_proxy::handle_stream_request(ctx.app_handle(), request, responder);
2727
})
2828
.invoke_handler(tauri::generate_handler![
29+
commands::is_flatpak,
2930
commands::copy_dir_recursive,
3031
commands::extract_zip,
3132
commands::download_file,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { FC, useEffect, useState } from 'react';
2+
3+
import { useTranslation } from '@nuclearplayer/i18n';
4+
import { Button } from '@nuclearplayer/ui';
5+
6+
import { isFlatpak } from '../services/tauri/commands';
7+
8+
const DISMISSED_KEY = 'flatpak-warning-dismissed';
9+
10+
export const FlatpakWarningBanner: FC = () => {
11+
const { t } = useTranslation('flatpak');
12+
const [visible, setVisible] = useState(false);
13+
14+
useEffect(() => {
15+
const wasDismissed = localStorage.getItem(DISMISSED_KEY) === 'true';
16+
if (wasDismissed) {
17+
return;
18+
}
19+
20+
isFlatpak().then((result) => {
21+
if (result) {
22+
setVisible(true);
23+
}
24+
});
25+
}, []);
26+
27+
const dismiss = () => {
28+
localStorage.setItem(DISMISSED_KEY, 'true');
29+
setVisible(false);
30+
};
31+
32+
if (!visible) {
33+
return null;
34+
}
35+
36+
return (
37+
<div
38+
data-testid="flatpak-warning-banner"
39+
className="bg-accent-orange flex items-center justify-center gap-4 px-3 py-1 text-xs tracking-wide text-[color-mix(in_oklch,var(--accent-orange),black_50%)] uppercase"
40+
>
41+
<span>{t('sandboxWarning')}</span>
42+
<Button
43+
variant="ghost"
44+
size="flexible"
45+
onClick={dismiss}
46+
data-testid="flatpak-warning-dismiss"
47+
className="px-2 py-0.5"
48+
>
49+
{t('dismiss')}
50+
</Button>
51+
</div>
52+
);
53+
};

packages/player/src/routes/__root.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
} from '../components/ConnectedQueuePanel';
3333
import { ConnectedTopBar } from '../components/ConnectedTopBar';
3434
import { DevTools } from '../components/DevTools';
35+
import { FlatpakWarningBanner } from '../components/FlatpakWarningBanner';
3536
import { SoundProvider } from '../components/SoundProvider';
3637
import { useLayoutStore } from '../stores/layoutStore';
3738

@@ -48,7 +49,10 @@ const RootComponent = () => {
4849

4950
return (
5051
<PlayerShell>
51-
<ConnectedTopBar />
52+
<div>
53+
<FlatpakWarningBanner />
54+
<ConnectedTopBar />
55+
</div>
5256
<SoundProvider>
5357
<PlayerWorkspace>
5458
<PlayerWorkspace.LeftSidebar

packages/player/src/services/tauri/commands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { invoke } from '@tauri-apps/api/core';
22

3+
export const isFlatpak = async (): Promise<boolean> => {
4+
return invoke<boolean>('is_flatpak');
5+
};
6+
37
export const copyDirRecursive = async (
48
from: string,
59
to: string,

packages/ui/src/components/Button/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import { ComponentPropsWithoutRef, forwardRef } from 'react';
55
import { cn } from '../../utils';
66

77
const buttonVariants = cva(
8-
'inline-flex cursor-pointer items-center rounded-md transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
8+
'inline-flex cursor-pointer items-center rounded-md whitespace-nowrap transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
99
{
1010
variants: {
1111
variant: {
1212
default:
1313
'text-foreground bg-primary border-border shadow-shadow hover:translate-x-shadow-x hover:translate-y-shadow-y border-2 hover:shadow-none',
1414
noShadow: 'text-foreground bg-primary border-border border-2',
1515
text: 'text-foreground bg-transparent',
16+
ghost: 'border border-current bg-transparent hover:bg-black/10',
1617
},
1718
size: {
1819
default: 'h-10 px-4 py-2',

0 commit comments

Comments
 (0)