-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-6398: Adjust admin-ui for Image Picker component #956
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
IBX-6398: Adjust admin-ui for Image Picker component
- Loading branch information
commit c1b479aef157d73b8e3996a103f9805d4f0f606f
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
15 changes: 15 additions & 0 deletions
15
src/bundle/ui-dev/src/modules/common/helpers/text.helper.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const fileSizeToString = (filesize) => { | ||
const units = ['bytes', 'KB', 'MB', 'GB']; | ||
const kilobyte = 1024; | ||
let size = parseInt(filesize, 10) || 0; | ||
let unitIndex = 0; | ||
|
||
while (size >= kilobyte) { | ||
size = size / kilobyte; | ||
unitIndex++; | ||
} | ||
|
||
const decimalUnits = unitIndex < 1 ? 0 : 1; | ||
|
||
return `${size.toFixed(size >= 10 || decimalUnits)} ${units[unitIndex]}`; | ||
}; |
28 changes: 28 additions & 0 deletions
28
src/bundle/ui-dev/src/modules/common/pagination/pagination.info.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const { Translator } = window; | ||
|
||
const PaginationInfo = ({ totalCount, viewingCount }) => { | ||
if (totalCount === 0) { | ||
return null; | ||
} | ||
|
||
const message = Translator.trans( | ||
/*@Desc("Viewing %viewingCount% out of %totalCount% items")*/ 'viewing_message', | ||
{ | ||
viewingCount, | ||
totalCount, | ||
}, | ||
'ibexa_sub_items', | ||
); | ||
|
||
return <div className="m-sub-items__pagination-info ibexa-pagination__info" dangerouslySetInnerHTML={{ __html: message }} />; | ||
}; | ||
|
||
PaginationInfo.propTypes = { | ||
totalCount: PropTypes.number.isRequired, | ||
viewingCount: PropTypes.number.isRequired, | ||
}; | ||
|
||
export default PaginationInfo; |
24 changes: 3 additions & 21 deletions
24
src/bundle/ui-dev/src/modules/multi-file-upload/helpers/text.helper.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,4 @@ | ||
/** | ||
* Returns a filesize as a formatted string | ||
* | ||
* @function fileSizeToString | ||
* @param {Number} filesize | ||
* @returns {String} | ||
*/ | ||
export const fileSizeToString = (filesize) => { | ||
const units = ['bytes', 'KB', 'MB', 'GB']; | ||
const kilobyte = 1024; | ||
let size = parseInt(filesize, 10) || 0; | ||
let unitIndex = 0; | ||
import { fileSizeToString as fileSizeToStringFromCommon } from '../../common/helpers/text.helper'; | ||
|
||
while (size >= kilobyte) { | ||
size = size / kilobyte; | ||
unitIndex++; | ||
} | ||
|
||
const decimalUnits = unitIndex < 1 ? 0 : 1; | ||
|
||
return `${size.toFixed(size >= 10 || decimalUnits)} ${units[unitIndex]}`; | ||
}; | ||
// @deprecated, will be removed in 5.0 | ||
export const fileSizeToString = fileSizeToStringFromCommon; |
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 |
---|---|---|
|
@@ -137,7 +137,23 @@ export const SearchTextContext = createContext(); | |
export const DropdownPortalRefContext = createContext(); | ||
|
||
const UniversalDiscoveryModule = (props) => { | ||
const { tabs } = ibexa.adminUiConfig.universalDiscoveryWidget; | ||
const { tabs: tabsWithPriority } = ibexa.adminUiConfig.universalDiscoveryWidget; | ||
const tabs = tabsWithPriority.reduce((tabsPrioritized, tabToAdd) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe put it in memo? Not sure if it's easy as you have to pass array There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed this approach. |
||
const tabWithSameIdIndex = tabsPrioritized.findIndex((tab) => tab.id === tabToAdd.id); | ||
|
||
if (tabWithSameIdIndex === -1) { | ||
tabsPrioritized.push(tabToAdd); | ||
} else { | ||
const currentTabPriority = tabsPrioritized[tabWithSameIdIndex].priority ?? -1; | ||
const tabToAddPriority = tabToAdd.priority ?? -1; | ||
|
||
if (currentTabPriority < tabToAddPriority) { | ||
tabsPrioritized[tabWithSameIdIndex] = tabToAdd; | ||
} | ||
} | ||
|
||
return tabsPrioritized; | ||
}, []); | ||
const defaultMarkedLocationId = props.startingLocationId || props.rootLocationId; | ||
const abortControllerRef = useRef(); | ||
const dropdownPortalRef = useRef(); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the same tab with a different id? could you explain why?
additionally: admin-ui should not have any knowledge about image-picker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it. The backend part for overwriting config will be done in a separate PR.