Skip to content

Commit 360d93b

Browse files
authored
Merge pull request pterodactyl#2777 from pterodactyl/matthewpi/file-manager-patch-1
Move file manager buttons beside the breadcrumb
2 parents 21d8dd4 + 616a6b8 commit 360d93b

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

resources/scripts/components/elements/SubNavigation.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ import config from '../../../../tailwind.config';
55

66
const SubNavigation = styled.div`
77
${tw`w-full bg-neutral-700 shadow overflow-x-auto`};
8-
8+
99
& > div {
1010
${tw`flex items-center text-sm mx-auto px-2`};
1111
max-width: 1200px;
12-
12+
1313
& > a, & > div {
1414
${tw`inline-block py-3 px-4 text-neutral-300 no-underline whitespace-no-wrap transition-all duration-150`};
15-
15+
1616
&:not(:first-of-type) {
1717
${tw`ml-2`};
1818
}
19-
20-
&:active, &:hover {
19+
20+
&:hover {
2121
${tw`text-neutral-100`};
2222
}
23-
24-
&:active, &:hover, &.active {
23+
24+
&:active, &.active {
25+
${tw`text-neutral-100`};
2526
box-shadow: inset 0 -2px ${config.theme.colors.cyan['500']};
2627
}
2728
}

resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default ({ withinFileEditor, isNewFile }: Props) => {
4444
};
4545

4646
return (
47-
<div css={tw`flex items-center text-sm mb-4 text-neutral-500`}>
47+
<div css={tw`flex flex-grow-0 items-center text-sm text-neutral-500 overflow-x-hidden`}>
4848
{(files && files.length > 0 && !params?.action) ?
4949
<FileActionCheckbox
5050
type={'checkbox'}

resources/scripts/components/server/files/FileManagerContainer.tsx

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,28 @@ export default () => {
5151

5252
return (
5353
<ServerContentBlock title={'File Manager'} showFlashKey={'files'}>
54-
<ErrorBoundary>
55-
<FileManagerBreadcrumbs/>
56-
</ErrorBoundary>
54+
<div css={tw`flex flex-wrap-reverse md:flex-no-wrap justify-center mb-4`}>
55+
<ErrorBoundary>
56+
<FileManagerBreadcrumbs/>
57+
</ErrorBoundary>
58+
59+
<Can action={'file.create'}>
60+
<ErrorBoundary>
61+
<div css={tw`flex flex-shrink-0 flex-wrap-reverse md:flex-no-wrap justify-end mb-4 md:mb-0 ml-0 md:ml-auto`}>
62+
<NewDirectoryButton css={tw`w-full flex-none mt-4 sm:mt-0 sm:w-auto sm:mr-4`}/>
63+
<UploadButton css={tw`flex-1 mr-4 sm:flex-none sm:mt-0`}/>
64+
<NavLink
65+
to={`/server/${id}/files/new${window.location.hash}`}
66+
css={tw`flex-1 sm:flex-none sm:mt-0`}
67+
>
68+
<Button css={tw`w-full`}>
69+
New File
70+
</Button>
71+
</NavLink>
72+
</div>
73+
</ErrorBoundary>
74+
</Can>
75+
</div>
5776
{
5877
!files ?
5978
<Spinner size={'large'} centered/>
@@ -83,22 +102,6 @@ export default () => {
83102
</div>
84103
</CSSTransition>
85104
}
86-
<Can action={'file.create'}>
87-
<ErrorBoundary>
88-
<div css={tw`flex flex-wrap-reverse justify-end mt-4`}>
89-
<NewDirectoryButton css={tw`w-full flex-none mt-4 sm:mt-0 sm:w-auto sm:mr-4`}/>
90-
<UploadButton css={tw`flex-1 mr-4 sm:flex-none sm:mt-0`}/>
91-
<NavLink
92-
to={`/server/${id}/files/new${window.location.hash}`}
93-
css={tw`flex-1 sm:flex-none sm:mt-0`}
94-
>
95-
<Button css={tw`w-full`}>
96-
New File
97-
</Button>
98-
</NavLink>
99-
</div>
100-
</ErrorBoundary>
101-
</Can>
102105
</>
103106
}
104107
</ServerContentBlock>

0 commit comments

Comments
 (0)