mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Migrate file actions
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, Tooltip, ButtonGroup, Spacer } from '@geist-ui/core';
|
import { ActionIcon, Tooltip, Group } from '@mantine/core';
|
||||||
import { Plus, Trash, GitPullRequest, GitCommit } from '@geist-ui/icons';
|
import {
|
||||||
|
IconPlus,
|
||||||
|
IconTrash,
|
||||||
|
IconGitPullRequest,
|
||||||
|
IconGitCommit,
|
||||||
|
} from '@tabler/icons-react';
|
||||||
import { useSettings } from '../contexts/SettingsContext';
|
import { useSettings } from '../contexts/SettingsContext';
|
||||||
import { useModalContext } from '../contexts/ModalContext';
|
import { useModalContext } from '../contexts/ModalContext';
|
||||||
|
|
||||||
@@ -17,70 +22,63 @@ const FileActions = ({ handlePullChanges, selectedFile }) => {
|
|||||||
const handleCommitAndPush = () => setCommitMessageModalVisible(true);
|
const handleCommitAndPush = () => setCommitMessageModalVisible(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup className="file-actions">
|
<Group gap="xs">
|
||||||
<Tooltip text="Create new file" type="dark">
|
<Tooltip label="Create new file">
|
||||||
<Button
|
<ActionIcon variant="default" size="md" onClick={handleCreateFile}>
|
||||||
icon={<Plus />}
|
<IconPlus size={16} />
|
||||||
auto
|
</ActionIcon>
|
||||||
scale={2 / 3}
|
|
||||||
onClick={handleCreateFile}
|
|
||||||
px={0.6}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Spacer w={0.5} />
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
text={selectedFile ? 'Delete current file' : 'No file selected'}
|
label={selectedFile ? 'Delete current file' : 'No file selected'}
|
||||||
type="dark"
|
|
||||||
>
|
>
|
||||||
<Button
|
<ActionIcon
|
||||||
icon={<Trash />}
|
variant="default"
|
||||||
auto
|
size="md"
|
||||||
scale={2 / 3}
|
|
||||||
onClick={handleDeleteFile}
|
onClick={handleDeleteFile}
|
||||||
disabled={!selectedFile}
|
disabled={!selectedFile}
|
||||||
type="error"
|
color="red"
|
||||||
px={0.6}
|
>
|
||||||
/>
|
<IconTrash size={16} />
|
||||||
|
</ActionIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Spacer w={0.5} />
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
text={
|
label={
|
||||||
settings.gitEnabled
|
settings.gitEnabled
|
||||||
? 'Pull changes from remote'
|
? 'Pull changes from remote'
|
||||||
: 'Git is not enabled'
|
: 'Git is not enabled'
|
||||||
}
|
}
|
||||||
type="dark"
|
|
||||||
>
|
>
|
||||||
<Button
|
<ActionIcon
|
||||||
icon={<GitPullRequest />}
|
variant="default"
|
||||||
auto
|
size="md"
|
||||||
scale={2 / 3}
|
|
||||||
onClick={handlePullChanges}
|
onClick={handlePullChanges}
|
||||||
disabled={!settings.gitEnabled}
|
disabled={!settings.gitEnabled}
|
||||||
px={0.6}
|
>
|
||||||
/>
|
<IconGitPullRequest size={16} />
|
||||||
|
</ActionIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Spacer w={0.5} />
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
text={
|
label={
|
||||||
!settings.gitEnabled
|
!settings.gitEnabled
|
||||||
? 'Git is not enabled'
|
? 'Git is not enabled'
|
||||||
: settings.gitAutoCommit
|
: settings.gitAutoCommit
|
||||||
? 'Auto-commit is enabled'
|
? 'Auto-commit is enabled'
|
||||||
: 'Commit and push changes'
|
: 'Commit and push changes'
|
||||||
}
|
}
|
||||||
type="dark"
|
|
||||||
>
|
>
|
||||||
<Button
|
<ActionIcon
|
||||||
icon={<GitCommit />}
|
variant="default"
|
||||||
auto
|
size="md"
|
||||||
scale={2 / 3}
|
|
||||||
onClick={handleCommitAndPush}
|
onClick={handleCommitAndPush}
|
||||||
disabled={!settings.gitEnabled || settings.gitAutoCommit}
|
disabled={!settings.gitEnabled || settings.gitAutoCommit}
|
||||||
px={0.6}
|
>
|
||||||
/>
|
<IconGitCommit size={16} />
|
||||||
|
</ActionIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ButtonGroup>
|
</Group>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user