mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
Use real links for navigation so they open in new tabs
In-app navigation was done with JS onClick -> navigate() handlers instead of real <a href> anchors, so the browser's right-click "Open in new tab" (and middle-click / ctrl-click) was unavailable. (closes #929) - Sidebar nav items and the account "user" entry now render their label as the existing Link component (a real anchor via react-router useHref), keeping the Menu onClick for plain left-clicks; stopPropagation avoids double navigation. - The "back to instances" alert action becomes a Link. - Table rows (Hosts, Roles, Plugins, Instances, Users, the user instance-stats table, Mod Packs): the name cell becomes a real Link (color inherit, so it looks unchanged) which carries the right-click context menu, and a new useRowNavigation hook handles the whole row — left-click navigates in place, middle-click / ctrl-click open the target in a new tab. The hook ignores clicks landing on a real link inside the row so the anchor handles those. Genuine actions (download/delete/modify/logout), post-create navigation and external links are left as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9e727f9a13
commit
f04fc68513
11 files changed
+123
-60
No files matched your search
@@ -16,6 +16,8 @@ import PageHeader from "./PageHeader";
|
||||
import PageLayout from "./PageLayout";
|
||||
import PluginExtra from "./PluginExtra";
|
||||
import SectionHeader from "./SectionHeader";
|
||||
import useRowNavigation from "../util/useRowNavigation";
|
||||
import Link from "./Link";
|
||||
import notify, { notifyErrorHandler } from "../util/notify";
|
||||
import { formatDuration } from "../util/time_format";
|
||||
import { formatFirstSeen, formatLastSeen, sortFirstSeen, sortLastSeen, useUser } from "../model/user";
|
||||
@@ -31,6 +33,7 @@ export default function UserViewPage() {
|
||||
let userName = params.name as string;
|
||||
|
||||
let navigate = useNavigate();
|
||||
const rowNav = useRowNavigation();
|
||||
|
||||
let account = useAccount();
|
||||
let control = useContext(ControlContext);
|
||||
@@ -298,7 +301,9 @@ export default function UserViewPage() {
|
||||
{
|
||||
title: "Instance",
|
||||
key: "instance",
|
||||
render: (_, [id]) => instanceName(id),
|
||||
render: (_, [id]) => <Link to={`/instances/${id}/view`} style={{ color: "inherit" }}>
|
||||
{instanceName(id)}
|
||||
</Link>,
|
||||
defaultSortOrder: "ascend",
|
||||
sorter: (a, b) => strcmp(instanceName(a[0]), instanceName(b[0])),
|
||||
},
|
||||
@@ -331,11 +336,7 @@ export default function UserViewPage() {
|
||||
dataSource={[...(user.instanceStats || []).entries()]}
|
||||
pagination={false}
|
||||
rowKey={([id]) => id}
|
||||
onRow={([id], rowIndex) => ({
|
||||
onClick: event => {
|
||||
navigate(`/instances/${id}/view`);
|
||||
},
|
||||
})}
|
||||
onRow={([id]) => rowNav(`/instances/${id}/view`)}
|
||||
/>
|
||||
<PluginExtra component="UserViewPage" user={user} />
|
||||
</PageLayout>;
|
||||
|
||||
Reference in new issue
Block a user