mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Make table link cells fill the cell and fix focus colour
Stretch the navigation link over the whole table cell (a position:relative cell with an ::after overlay) so the entire name cell - and the Instances Assigned Host cell - is clickable and right-click "open in new tab"-able, not just the text. Also force color:inherit on the sidebar and account links so the focus left behind by a middle-click no longer shows them blue. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f04fc68513
commit
448eb9223d
9 files changed
+24
-2
No files matched your search
@@ -220,6 +220,7 @@ export default function HostsPage() {
|
|||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
defaultSortOrder: "ascend",
|
defaultSortOrder: "ascend",
|
||||||
sorter: (a, b) => strcmp(a.name, b.name),
|
sorter: (a, b) => strcmp(a.name, b.name),
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, host) => <Link to={`/hosts/${host.id}/view`} style={{ color: "inherit" }}>
|
render: (_, host) => <Link to={`/hosts/${host.id}/view`} style={{ color: "inherit" }}>
|
||||||
{host.name}
|
{host.name}
|
||||||
</Link>,
|
</Link>,
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export default function InstanceList(props: InstanceListProps) {
|
|||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
defaultSortOrder: "ascend",
|
defaultSortOrder: "ascend",
|
||||||
sorter: (a, b) => strcmp(a["name"], b["name"]),
|
sorter: (a, b) => strcmp(a["name"], b["name"]),
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, instance) => <Link to={`/instances/${instance.id}/view`} style={{ color: "inherit" }}>
|
render: (_, instance) => <Link to={`/instances/${instance.id}/view`} style={{ color: "inherit" }}>
|
||||||
{instance.name}
|
{instance.name}
|
||||||
</Link>,
|
</Link>,
|
||||||
@@ -56,6 +57,7 @@ export default function InstanceList(props: InstanceListProps) {
|
|||||||
{
|
{
|
||||||
title: "Assigned Host",
|
title: "Assigned Host",
|
||||||
key: "assignedHost",
|
key: "assignedHost",
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, instance) => <Space>
|
render: (_, instance) => <Space>
|
||||||
<Link
|
<Link
|
||||||
to={`/hosts/${instance.assignedHost}/view`}
|
to={`/hosts/${instance.assignedHost}/view`}
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ export default function ModsPage() {
|
|||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
defaultSortOrder: "ascend",
|
defaultSortOrder: "ascend",
|
||||||
sorter: (a, b) => strcmp(a.name, b.name),
|
sorter: (a, b) => strcmp(a.name, b.name),
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, modPack) => <Link
|
render: (_, modPack) => <Link
|
||||||
to={`/mods/mod-packs/${modPack.id}/view`}
|
to={`/mods/mod-packs/${modPack.id}/view`}
|
||||||
style={{ color: "inherit" }}
|
style={{ color: "inherit" }}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export default function PluginsPage() {
|
|||||||
{
|
{
|
||||||
title: "Name",
|
title: "Name",
|
||||||
key: "name",
|
key: "name",
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, plugin) => <Link
|
render: (_, plugin) => <Link
|
||||||
to={`/plugins/${plugin.meta.name}/view`}
|
to={`/plugins/${plugin.meta.name}/view`}
|
||||||
style={{ color: "inherit" }}
|
style={{ color: "inherit" }}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ export default function RolesPage() {
|
|||||||
title: "Name",
|
title: "Name",
|
||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
sorter: (a, b) => strcmp(a.name, b.name),
|
sorter: (a, b) => strcmp(a.name, b.name),
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, role) => <Link to={`/roles/${role.id}/view`} style={{ color: "inherit" }}>
|
render: (_, role) => <Link to={`/roles/${role.id}/view`} style={{ color: "inherit" }}>
|
||||||
{role.name}
|
{role.name}
|
||||||
</Link>,
|
</Link>,
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ const { Header, Sider } = Layout;
|
|||||||
// Render a sidebar menu label as a real link so right-click/middle-click can
|
// Render a sidebar menu label as a real link so right-click/middle-click can
|
||||||
// open it in a new tab; stopPropagation keeps the Menu onClick from also firing.
|
// open it in a new tab; stopPropagation keeps the Menu onClick from also firing.
|
||||||
function navLink(path: string, label: string) {
|
function navLink(path: string, label: string) {
|
||||||
return <Link to={path} onClick={e => e.stopPropagation()}>{label}</Link>;
|
// color: inherit keeps the menu colour in every state (incl. the focus left
|
||||||
|
// behind by a middle-click, which would otherwise show the link blue).
|
||||||
|
return <Link to={path} style={{ color: "inherit" }} onClick={e => e.stopPropagation()}>{label}</Link>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActiveDropzone(element: HTMLElement | null): boolean {
|
function isActiveDropzone(element: HTMLElement | null): boolean {
|
||||||
@@ -82,7 +84,8 @@ export default function SiteLayout() {
|
|||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: <Link to={`/users/${account.name}/view`} onClick={e => e.stopPropagation()}>
|
label: <Link to={`/users/${account.name}/view`} style={{ color: "inherit" }}
|
||||||
|
onClick={e => e.stopPropagation()}>
|
||||||
{account.name}
|
{account.name}
|
||||||
</Link>,
|
</Link>,
|
||||||
key: "user",
|
key: "user",
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ export default function UserViewPage() {
|
|||||||
{
|
{
|
||||||
title: "Instance",
|
title: "Instance",
|
||||||
key: "instance",
|
key: "instance",
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_, [id]) => <Link to={`/instances/${id}/view`} style={{ color: "inherit" }}>
|
render: (_, [id]) => <Link to={`/instances/${id}/view`} style={{ color: "inherit" }}>
|
||||||
{instanceName(id)}
|
{instanceName(id)}
|
||||||
</Link>,
|
</Link>,
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export default function UsersTable({ instanceId, onlyOnline = false, pagination,
|
|||||||
{
|
{
|
||||||
title: "Name",
|
title: "Name",
|
||||||
key: "name",
|
key: "name",
|
||||||
|
className: "table-link-cell",
|
||||||
render: (_: any, user: lib.UserDetails) => (
|
render: (_: any, user: lib.UserDetails) => (
|
||||||
<Link to={`/users/${user.name}/view`} style={{ color: "inherit" }}>
|
<Link to={`/users/${user.name}/view`} style={{ color: "inherit" }}>
|
||||||
<Username user={user} withStatus />
|
<Username user={user} withStatus />
|
||||||
|
|||||||
@@ -10,6 +10,17 @@ body {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make a table name-cell link fill the whole cell, so the entire cell is
|
||||||
|
clickable and right-click "open in new tab"-able, not just the text. */
|
||||||
|
.table-link-cell {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.table-link-cell a::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.login-container {
|
.login-container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in new issue
Block a user