-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: set width fail * feat: update code * feat: update code * feat: update code * feat: update code --------- Co-authored-by: 杨国璇 <[email protected]>
- Loading branch information
1 parent
0921335
commit e2bb71e
Showing
13 changed files
with
114 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
frontend/src/components/dirent-detail/detail/detail/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
@keyframes move { | ||
from { | ||
right: -500px; | ||
opacity: 0.5; | ||
} | ||
to { | ||
right: 0px; | ||
opacity: 1; | ||
} | ||
} | ||
|
||
.cur-view-detail { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: #fff; | ||
width: 400px; | ||
height: 100%; | ||
border-left: 1px solid #eee; | ||
animation: move .5s ease-in-out 1; | ||
position: relative; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 4 additions & 12 deletions
16
frontend/src/components/dirent-detail/dirent-details/dir-details.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { MetadataStatusProvider, useMetadataStatus } from './metadata-status'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; | ||
import metadataAPI from '../api'; | ||
import { Utils } from '../../utils/utils'; | ||
import toaster from '../../components/toast'; | ||
|
||
const MetadataStatusContext = React.createContext(null); | ||
|
||
export const MetadataStatusProvider = ({ repoID, children }) => { | ||
const enableMetadataManagement = useMemo(() => { | ||
return window.app.pageOptions.enableMetadataManagement; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [window.app.pageOptions.enableMetadataManagement]); | ||
|
||
|
||
const [enableExtendedProperties, setEnableExtendedProperties] = useState(false); | ||
|
||
useEffect(() => { | ||
if (!enableMetadataManagement) { | ||
setEnableExtendedProperties(false); | ||
return; | ||
} | ||
metadataAPI.getMetadataStatus(repoID).then(res => { | ||
setEnableExtendedProperties(res.data.enabled); | ||
}).catch(error => { | ||
const errorMsg = Utils.getErrorMsg(error, true); | ||
toaster.danger(errorMsg); | ||
setEnableExtendedProperties(false); | ||
}); | ||
}, [repoID, enableMetadataManagement]); | ||
|
||
const updateEnableExtendedProperties = useCallback((newValue) => { | ||
if (newValue === enableExtendedProperties) return; | ||
setEnableExtendedProperties(newValue); | ||
}, [enableExtendedProperties]); | ||
|
||
return ( | ||
<MetadataStatusContext.Provider value={{ enableExtendedProperties, updateEnableExtendedProperties }}> | ||
{children} | ||
</MetadataStatusContext.Provider> | ||
); | ||
}; | ||
|
||
export const useMetadataStatus = () => { | ||
const context = useContext(MetadataStatusContext); | ||
if (!context) { | ||
throw new Error('\'MetadataStatusContext\' is null'); | ||
} | ||
const { enableExtendedProperties, updateEnableExtendedProperties } = context; | ||
return { enableExtendedProperties, updateEnableExtendedProperties }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.