feat: improve mobile git and diff experience
This commit is contained in:
@@ -20,6 +20,7 @@ interface TabConfig {
|
|||||||
label: string;
|
label: string;
|
||||||
icon: RemixiconComponentType;
|
icon: RemixiconComponentType;
|
||||||
badge?: number;
|
badge?: number;
|
||||||
|
showDot?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FixedSessionsButton: React.FC = () => {
|
export const FixedSessionsButton: React.FC = () => {
|
||||||
@@ -265,7 +266,12 @@ export const Header: React.FC = () => {
|
|||||||
badge: !isMobile && diffFileCount > 0 ? diffFileCount : undefined,
|
badge: !isMobile && diffFileCount > 0 ? diffFileCount : undefined,
|
||||||
},
|
},
|
||||||
{ id: 'terminal', label: 'Terminal', icon: RiTerminalBoxLine },
|
{ id: 'terminal', label: 'Terminal', icon: RiTerminalBoxLine },
|
||||||
{ id: 'git', label: 'Git', icon: RiGitBranchLine },
|
{
|
||||||
|
id: 'git',
|
||||||
|
label: 'Git',
|
||||||
|
icon: RiGitBranchLine,
|
||||||
|
showDot: isMobile && diffFileCount > 0,
|
||||||
|
},
|
||||||
], [diffFileCount, isMobile]);
|
], [diffFileCount, isMobile]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -469,6 +475,7 @@ export const Header: React.FC = () => {
|
|||||||
role="tab"
|
role="tab"
|
||||||
className={cn(
|
className={cn(
|
||||||
headerIconButtonClass,
|
headerIconButtonClass,
|
||||||
|
'relative',
|
||||||
isActive && 'text-foreground'
|
isActive && 'text-foreground'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -478,6 +485,12 @@ export const Header: React.FC = () => {
|
|||||||
{tab.badge}
|
{tab.badge}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
{tab.showDot && (
|
||||||
|
<span
|
||||||
|
className="absolute top-1.5 right-1.5 h-2 w-2 rounded-full bg-primary"
|
||||||
|
aria-label="Changes available"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>
|
<TooltipContent>
|
||||||
|
|||||||
@@ -305,8 +305,10 @@ export const DiffView: React.FC = () => {
|
|||||||
const diffLayoutPreference = useUIStore((state) => state.diffLayoutPreference);
|
const diffLayoutPreference = useUIStore((state) => state.diffLayoutPreference);
|
||||||
const diffFileLayout = useUIStore((state) => state.diffFileLayout);
|
const diffFileLayout = useUIStore((state) => state.diffFileLayout);
|
||||||
const setDiffFileLayout = useUIStore((state) => state.setDiffFileLayout);
|
const setDiffFileLayout = useUIStore((state) => state.setDiffFileLayout);
|
||||||
const diffWrapLines = useUIStore((state) => state.diffWrapLines);
|
const diffWrapLinesStore = useUIStore((state) => state.diffWrapLines);
|
||||||
const setDiffWrapLines = useUIStore((state) => state.setDiffWrapLines);
|
const setDiffWrapLines = useUIStore((state) => state.setDiffWrapLines);
|
||||||
|
// Default to wrap on mobile
|
||||||
|
const diffWrapLines = isMobile || diffWrapLinesStore;
|
||||||
|
|
||||||
const changedFiles: FileEntry[] = React.useMemo(() => {
|
const changedFiles: FileEntry[] = React.useMemo(() => {
|
||||||
if (!status?.files) return [];
|
if (!status?.files) return [];
|
||||||
@@ -564,7 +566,7 @@ export const DiffView: React.FC = () => {
|
|||||||
{selectedFileEntry && (
|
{selectedFileEntry && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setDiffWrapLines(!diffWrapLines)}
|
onClick={() => setDiffWrapLines(!diffWrapLinesStore)}
|
||||||
className={`flex items-center justify-center size-5 rounded-sm transition-opacity ${
|
className={`flex items-center justify-center size-5 rounded-sm transition-opacity ${
|
||||||
diffWrapLines
|
diffWrapLines
|
||||||
? 'text-foreground opacity-100'
|
? 'text-foreground opacity-100'
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ export const ChangeRow = React.memo<ChangeRowProps>(function ChangeRow({
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={handleRevertClick}
|
onClick={handleRevertClick}
|
||||||
disabled={isReverting}
|
disabled={isReverting}
|
||||||
className="flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50 transition-opacity"
|
className="flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
||||||
aria-label={`Revert changes for ${file.path}`}
|
aria-label={`Revert changes for ${file.path}`}
|
||||||
>
|
>
|
||||||
{isReverting ? (
|
{isReverting ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user