修改cloudcloudIde

This commit is contained in:
何童崇 2022-08-16 15:39:15 +08:00
parent 5b0d73bbd6
commit d4adba77a8
6 changed files with 107 additions and 28 deletions

View File

@ -31,7 +31,7 @@
<script src="%PUBLIC_URL%js/editormd/editormd.min.js"></script>
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
<script src="https://gw.alipayobjects.com/os/lib/moment/2.29.4/moment.js"></script>
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.12-2/bundle/alex.all.global.js"></script>
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.13-0/bundle/alex.all.global.js"></script>
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>

View File

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200">
<defs>
<linearGradient id="linear-gradient" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox">
<stop offset="0" stop-color="#6dffff"/>
<stop offset="1" stop-color="#0080ff"/>
</linearGradient>
</defs>
<g id="组_1758" data-name="组 1758" transform="translate(9483 -10311)">
<rect id="矩形_340" data-name="矩形 340" width="200" height="200" transform="translate(-9483 10311)" fill="#fff" opacity="0"/>
<g id="图层_2" data-name="图层 2" transform="translate(-9472 10328)">
<g id="图层_1" data-name="图层 1">
<path id="路径_1227" data-name="路径 1227" d="M127.508,32.458,123.06,26.4l-3.9,1.958V77.007l3.239,1.7v-5.4l5.11,8.248,4.145.648V23.03l-4.145,1.6ZM35.847,82.2l9.284-4.62V27.708L35.847,23.03Zm63.463,6.29,8.305,4.951V9.241L99.31,14.192ZM87.378,0H75.863V105.291H93.509V94.841H87.378ZM49.954,21.821l4.577,1.684V93.344l8.348-4.318V27.132l4.477,1.655V19.3L49.954,9.226ZM5.448,78.634,25.6,68.457V49.3l-9.543-1.022v6.736h3.829V61.52l-6.621,3.008V43.873L25.541,46.06V38.216L5.39,31.58ZM154.18,54.855,168.919,31.58l-11.04,1.195-7.355,9.788V36.071L142.406,38V73.006l8.118,1.684V67.982l7.845,10.076,12.7.633Z" transform="translate(2.368)" fill-rule="evenodd" fill="url(#linear-gradient)"/>
<path id="路径_1228" data-name="路径 1228" d="M0,110.683a27.2,27.2,0,0,0,2.634-4.577q1.051-2.375,1.727-4.4a33.61,33.61,0,0,0,.979-3.527c.2-.993.317-1.612.345-1.9V92.964h-3.5V88.876H17.445v4.088H9.37V96.75q0,.158-.432,2.245a34.545,34.545,0,0,1-1.439,5.11h5.556v-.72H16.74V122.86a4.822,4.822,0,0,1-1.209,3.325,3.915,3.915,0,0,1-3.008,1.339h-8.2V110.942l-.72,1.137c-.23.389-.489.763-.763,1.152Zm8.017,12.753h4.491c.36,0,.547-.187.547-.576V108.193H8.017Zm9.471-27.521q1.209-1.6,2.073-2.879c.576-.82,1.195-1.77,1.842-2.879a28.457,28.457,0,0,0,1.727-3.267L26.4,88.7a17.271,17.271,0,0,1-.849,1.713H39.727V93.67l-3.354,4.995h2v-.777h3.685v24.758a4.808,4.808,0,0,1-1.209,3.325,3.872,3.872,0,0,1-2.98,1.353h-2.1v-4.045h2.058c.374,0,.547-.2.547-.619v-3.368h-6.29v7.2H28.4v-7.2H22.3q-.23,1.67-.518,3.109c-.187.964-.36,1.814-.533,2.562s-.317,1.353-.446,1.814a7.658,7.658,0,0,0-.187.748l-1.77-.619-1.727-.619c.4-1.6.734-3.008.979-4.318s.475-2.648.677-4.189a35.307,35.307,0,0,0,.3-4.592V98.664H31.811l2.735-4.088H23.131q-1.123,1.756-1.986,2.879l-.993,1.108ZM28.4,115.188v-4.707H22.757v4.707Zm-5.642-12.436v3.627H28.4v-3.627Zm15.617,0h-6.29v3.627h6.29Zm0,12.436v-4.707h-6.29v4.707Z" transform="translate(0 38.179)" fill="#333"/>
<path id="路径_1229" data-name="路径 1229" d="M32.82,110.943H51.014c.518-.806.993-1.612,1.439-2.447a15.2,15.2,0,0,0,1.036-2.634V97.168h3.685V106.7a21.591,21.591,0,0,1-1.7,4.2H73.382v4.088H58.427l14.509,8.751L71.151,127.4,55.49,117.91l1.439-2.879H52.756a31.018,31.018,0,0,1-3.742,3.786,41.975,41.975,0,0,1-4.045,3.051,43.833,43.833,0,0,1-3.944,2.361c-1.267.677-2.418,1.223-3.426,1.655s-1.842.777-2.49,1.008l-1.123.417-.518-1.972-.5-1.914s.5-.173,1.439-.547,2.116-.878,3.527-1.569,2.965-1.555,4.635-2.591a32.934,32.934,0,0,0,4.908-3.685H32.82Zm.1-19.849H51.287l-1.166-2.433,3.267-1.871,2,4.318H69.251v-.734h3.685V99.86H69.251V95.182H36.606v4.865H32.921Zm4.75,10.824,9.889,4.462-1.353,3.742-9.889-4.462Zm12.681,3.325-9.831-4.62,1.439-3.786,9.831,4.649Z" transform="translate(14.421 38.135)" fill="#333"/>
<path id="路径_1230" data-name="路径 1230" d="M105.835,108.223h-9.37v18.453h-3.7V108.223H77.307a38.49,38.49,0,0,1-2.03,7.125,62.419,62.419,0,0,1-2.634,5.758,44.3,44.3,0,0,1-2.332,3.944c-.691.979-1.065,1.526-1.123,1.626l-2.879-2.591.907-1.3a34.806,34.806,0,0,0,2.015-3.4c.763-1.439,1.54-3.109,2.346-5.023a34.877,34.877,0,0,0,1.958-6.146H64.05v-4.088H74.126V92.117H66.857V88h36.229v4.1H96.465v12.019h9.37Zm-13.07-4.088V92.117H77.955v12.019Z" transform="translate(28.143 38.666)" fill="#333"/>
<path id="路径_1231" data-name="路径 1231" d="M98.847,127.257l-3.267-1.77,6.348-14.394,3.311,1.814Zm3.958-29.8L96,90.667l2.433-3.008,6.852,6.794Zm0,10.882L96,101.549l2.433-3.008,6.852,6.794Zm.187,16.985c.317-.59.72-1.439,1.238-2.533a29.74,29.74,0,0,0,1.439-3.6,34.757,34.757,0,0,0,1.281-3.987,14.767,14.767,0,0,0,.547-3.714V87.4h28.788v4.1H111.255V111.5a17.965,17.965,0,0,1-.36,3.4,30.226,30.226,0,0,1-.921,3.527c-.374,1.152-.777,2.26-1.209,3.311s-.82,2-1.195,2.879-.691,1.439-.964,2l-.446.849Zm7.931-.1a34.386,34.386,0,0,0,2.116-4.059c.576-1.339,1.051-2.519,1.439-3.555a30.893,30.893,0,0,0,1.022-3.527l3.6.993s-.1.461-.288,1.18-.475,1.67-.878,2.879-.921,2.461-1.569,3.93a35.5,35.5,0,0,1-2.346,4.491Zm13.617-31.451-1.022,1.871h7.787v-.936h3.742v13.7a4.836,4.836,0,0,1-1.209,3.3,3.858,3.858,0,0,1-2.994,1.439H126.1v9.586a4.736,4.736,0,0,1-1.223,3.282,3.8,3.8,0,0,1-2.98,1.439h-2.749v-4.1h2.706a.576.576,0,0,0,.4-.144.6.6,0,0,0,.158-.417v-9.586h-8.953V95.648h5.758L121.46,91.6Zm6.765,6H117.128v2.792h14.178Zm-.518,9.27q.518,0,.518-.561v-1.814H117.128v2.375ZM132,113.827l4.433,11.8-3.4,1.5-4.318-11.8Z" transform="translate(41.997 38.403)" fill="#333"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from 'react';
// import { default as AntcodeCR } from 'acr';
import { ACR } from 'alex';
import { Button, Switch, Spin } from 'antd';
import { Button, Switch, Spin, Icon } from 'antd';
// blame worker
import CodeBlame from './extensions/alex-ext-public.editor-plugin-blame.js';
// plugin
@ -26,6 +26,7 @@ import { projectService } from './mock/project.service';
import { lsifService } from './mock/lsif.service';
import { useFileReadMarkChange$ } from './hooks';
import { repoService } from './mock/repo.service';
import ideLogo from './ideLogo.svg';
const CodeReview = (props) => {
@ -91,12 +92,30 @@ const CodeReview = (props) => {
ExtensionCommand.setProjectData,
projectData
);
//
blamePlugin.commands && blamePlugin.commands.executeCommand(
'alex.setDefaultPreference',
'acr.lsifEnabled',
false
);
}, [pluginActivated, diffsPack]);
if (!diffsPack) {
return <Spin style={{ height: "100vh" }} spinning={true}></Spin>
}
function EditorEmpty() {
return <div className='ide-logo'>
<img className='ide-logo-img' src={ideLogo} />
<div>
<div className='ide-logo-text'>IDE代码体验高效的代码编辑</div>
<div className='ide-logo-text'>标记文件为已查看</div>
<div className='ide-logo-text'>快速打开变更文件</div>
<div className='ide-logo-text'>切换变更文件</div>
</div>
</div>
}
// <Icon className='ide-btn-demo' type="arrow-up" /> <Icon className='ide-btn-demo' type="arrow-down" />
const propsIDE = {
//
noteIdToReplyIdSet: commentPack.noteIdToReplyIdSet,
@ -119,14 +138,14 @@ const CodeReview = (props) => {
getDiffById,
diffs: diffsPack.diffs,
latestCommitSha: pr.diff.headCommitSha,
projectId: project.id,
projectPath: project.pathWithNamespace,
pullRequestId: pr.id,
projectId: projectsId,
projectPath: `${owner}/${projectsId}`,
pullRequestId: mergeId,
pr,
//
getLanguages: () =>
projectService
.getLanguages(project.id, {
.getLanguages(projectsId, {
aggBy: 'file_extension',
//
orderBy: 'count',
@ -162,18 +181,18 @@ const CodeReview = (props) => {
projectService.bulkChangeFiles(pr.forkProject.identifier, pr.forkProject.login, data).then(res => {
if (res) {
// giteacommit
setTimeout(()=>{
setTimeout(() => {
setAcrFlag({});
},8000)
}, 1000)
}
})
} else {
projectService.bulkChangeFiles(projectsId, owner, data).then(res => {
if (res) {
// giteacommit
setTimeout(()=>{
// giteacommit
setTimeout(() => {
setAcrFlag({});
},8000)
}, 1000)
}
})
}
@ -200,6 +219,8 @@ const CodeReview = (props) => {
annotations: annotationPacks,
AnnotationEntry,
PRMoreActionLinks,
EditorEmpty: EditorEmpty,
onigWasmUri: 'https://gw.alipayobjects.com/os/lib/vscode-oniguruma/1.6.2/release/onig.wasm',
//
isFullscreen,
appConfig: {

View File

@ -168,13 +168,13 @@ const useCommentPack = (projectId, prId) => {
}
//
async function doRefresh(force = false,filePath) {
async function doRefresh(force = false, filePath) {
if (fetchingRef.current) {
return;
}
fetchingRef.current = true;
//
const commentPack = await prService.getCommentPack(projectsId, owner, mergeId,{path:filePath,is_full:true});
const commentPack = await prService.getCommentPack(projectsId, owner, mergeId, { path: filePath, is_full: true });
const reviews = await prService.getReviews(projectsId, owner, mergeId);
// debugger
for (const review of reviews) {
@ -344,9 +344,9 @@ const [NoteProvider, useNote] = createContainer(() => {
commentPack.manualAddNote(note, commentPack.pendingReviewRef.current);
}
async function deleteComment(id){
const res = await prService.deleteComment(projectsId, owner, mergeId,id);
if(res.status==0){
async function deleteComment(id) {
const res = await prService.deleteComment(projectsId, owner, mergeId, id);
if (res.status == 0) {
commentPack.manualRemoveNote(id);
}
}
@ -394,7 +394,7 @@ const [ReadMarkProvider, useReadMark] = createContainer(() => {
const map = new Map();
if (!readMarks) return map;
for (const mark of readMarks) {
mark.markAsRead&& map.set(mark.filePathSha, mark);
mark.markAsRead && map.set(mark.filePathSha, mark);
}
return map;
}, [readMarks]);
@ -447,7 +447,6 @@ const [ReadMarkProvider, useReadMark] = createContainer(() => {
});
const [AcrProvider, useAcr] = createContainer(() => {
const [acrflag, setAcrFlag] = useState({});
const { params } = useGlobal();
const { pr } = usePr();
const { charsetName } = useSetting();
@ -459,8 +458,10 @@ const [AcrProvider, useAcr] = createContainer(() => {
setIDEMode((v) => !v);
}, [setIDEMode]);
const [stDiff,setStDiff]=useState({});
const [stDiff, setStDiff] = useState({});
const [search, setSearch] = useState(window.location.search);
const [acrflag, setAcrFlag] = useState();
const [versions, setVersions] = useState([]);
const query = useMemo(() => {
const searchParams = new URLSearchParams(search);
const ret = {};
@ -490,10 +491,20 @@ const [AcrProvider, useAcr] = createContainer(() => {
setSearch(search);
}
const versions = useRequest(
async () => await prService.getDiffVersions(projectsId, owner, mergeId),
{ initial: [],deps:[acrflag] }
);
async function getDiffVersions() {
const data = await prService.getDiffVersions(projectsId, owner, mergeId);
if (acrflag && data.length == versions.length) {
setTimeout(() => {
setAcrFlag({});
}, 3000);
}
setVersions(data);
}
useEffect(() => {
getDiffVersions()
}, [acrflag])
const versionMap = useMemo(() => {
@ -567,14 +578,14 @@ const [AcrProvider, useAcr] = createContainer(() => {
commentPack.doRefresh();
}, []);
async function getDiffById(diffId) {
let thisStDiff= await prService.getDiffById(projectsId, owner, mergeId, toVersion.id,
async function getDiffById(diffId) {
let thisStDiff = await prService.getDiffById(projectsId, owner, mergeId, toVersion.id,
{
filepath: diffId,
});
delete thisStDiff.sections
setStDiff(thisStDiff);
commentPack.doRefresh(false,diffId);
commentPack.doRefresh(false, diffId);
return thisStDiff;
}
@ -642,12 +653,12 @@ export const Provider = (props) => {
pathWithNamespace: details.full_name,
}
}
let user={};
let user = {};
if (props.current_user) {
let current_user = props.current_user;
user = { ...current_user, avatar_url: current_user.image_url, name: current_user.username, };
}
return (
<ContextProps.Provider value={{
project, user, params: match.params

View File

@ -47,3 +47,29 @@ body,
color: @c45;
}
}
.ide-logo{
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.ide-logo-img{
width: 150px;
}
.ide-logo-text{
color: #aaa;
margin-top: .5em;
font-size: 14px;
&:nth-child(2){
margin-left: 2em;
}
&:nth-child(3){
margin-left: 2em;
}
&:nth-child(4){
margin-left: 4em;
}
}

View File

@ -71,6 +71,7 @@ function Index({onCancel,avatarImg,login}){
width="638px"
footer={null}
centered
maskClosable={false}
title="修改头像"
onCancel={()=>onCancel(false)}
className="avatarBox"