mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 12:10:28 +00:00
Styled some stuff
This commit is contained in:
parent
d061ab4803
commit
46186d8d23
2 changed files with 48 additions and 1 deletions
|
|
@ -39,14 +39,26 @@ const MobileApp = ({
|
|||
key={file.filePath}
|
||||
style={{
|
||||
width: "100%",
|
||||
paddingTop: "var(--size-4-4)",
|
||||
paddingBottom: "var(--size-4-4)",
|
||||
borderBottom: "1px solid var(--background-modifier-border)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="inline-title"
|
||||
style={{
|
||||
width: "100%",
|
||||
paddingLeft: "var(--size-4-8)",
|
||||
paddingRight: "var(--size-4-8)",
|
||||
}}
|
||||
>
|
||||
{file.filePath}
|
||||
</div>
|
||||
<UnifiedDiffView
|
||||
initialOldText={file.remoteContent || ""}
|
||||
initialNewText={file.localContent || ""}
|
||||
onConflictResolved={() => onConflictResolved(index)}
|
||||
/>
|
||||
<hr />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -240,16 +240,31 @@ const UnifiedDiffView: React.FC<UnifiedDiffViewProps> = ({
|
|||
diffChunks,
|
||||
);
|
||||
|
||||
const [hasConflicts, setHasConflicts] = React.useState(diffChunks.length > 0);
|
||||
|
||||
const extensions = React.useMemo(() => {
|
||||
const conflictRangesField = createRangesStateField(lineRanges);
|
||||
return [
|
||||
conflictRangesField,
|
||||
createDecorationsExtension(conflictRangesField),
|
||||
EditorView.updateListener.of((update) => {
|
||||
if (update.docChanged) {
|
||||
const conflictRanges = update.state.field(conflictRangesField);
|
||||
const allConflictsSolved = conflictRanges.some(
|
||||
(range) => range.source === "old" || range.source === "new",
|
||||
);
|
||||
|
||||
if (!allConflictsSolved) {
|
||||
setHasConflicts(allConflictsSolved);
|
||||
}
|
||||
}
|
||||
}),
|
||||
EditorView.editable.of(true),
|
||||
EditorView.theme({
|
||||
"&": {
|
||||
backgroundColor: "var(--background-primary)",
|
||||
color: "var(--text-normal)",
|
||||
border: "1px solid var(--background-modifier-border)",
|
||||
},
|
||||
".cm-content": {
|
||||
padding: 0,
|
||||
|
|
@ -279,6 +294,26 @@ const UnifiedDiffView: React.FC<UnifiedDiffViewProps> = ({
|
|||
basicSetup={false}
|
||||
extensions={extensions}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
paddingTop: "var(--size-4-4)",
|
||||
}}
|
||||
>
|
||||
<button
|
||||
style={{
|
||||
backgroundColor: "var(--interactive-accent)",
|
||||
color: "var(--text-on-accent)",
|
||||
}}
|
||||
disabled={hasConflicts}
|
||||
onClick={() => {
|
||||
console.log("Conflict resolved");
|
||||
}}
|
||||
>
|
||||
Resolve conflict
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue