This commit is contained in:
Mirco Wittrien 2020-08-04 13:17:02 +02:00
parent 11444f778f
commit 1cb4c41c19
3 changed files with 24 additions and 10 deletions

View File

@ -4162,6 +4162,7 @@
inputNumberWrapper: "numberInputWrapper-j4svZS",
inputNumberWrapperDefault: "numberInputWrapperDefault-gRxcuK numberInputWrapper-j4svZS",
inputNumberWrapperMini: "numberInputWrapperMini-wtUU31 numberInputWrapper-j4svZS",
listRow: "listRow-7SfZww",
loadingIcon: "loadingIcon-cOYMPl",
loadingIconWrapper: "loadingIconWrapper-PsVJ9m",
overflowEllipsis: "ellipsis-qlo9sA",
@ -5485,6 +5486,7 @@
listname: ["UserProfile", "listName"],
listrow: ["UserProfile", "listRow"],
listrowcontent: ["UserProfile", "listRowContent"],
listrowwrapper: ["BDFDB", "listRow"],
listscroller: ["UserProfile", "listScroller"],
livetag: ["LiveTag", "live"],
livetaggrey: ["LiveTag", "grey"],
@ -8122,7 +8124,7 @@
InternalComponents.LibraryComponents.ListRow = InternalBDFDB.loadPatchedComp("ListRow") || reactInitialized && class BDFDB_ListRow extends LibraryModules.React.Component {
render () {
return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.listrow, this.props.className),
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.listrowwrapper, this.props.className, BDFDB.disCN.listrow),
children: [
this.props.prefix,
BDFDB.ReactUtils.createElement("div", {
@ -8300,6 +8302,7 @@
jump(offset) {
if (offset > -1 && offset < Math.ceil(this.props.items.length/this.props.amount) && this.props.offset != offset) {
this.props.offset = offset;
if (typeof this.props.onJump == "function") this.props.onJump(offset, this);
BDFDB.ReactUtils.forceUpdate(this);
}
}
@ -8909,7 +8912,11 @@
!usePagination ? this.props.data.map(renderItem) : BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.PaginatedList, Object.assign({}, this.props.pagination, {
header: header,
items: this.props.data,
renderItem: renderItem
renderItem: renderItem,
onJump: (offset, instance) => {
this.props.pagination.offset = offset;
if (typeof this.props.pagination.onJump == "function") this.props.pagination.onJump(offset, this, instance);
}
}))
].filter(n => n)
});
@ -9933,6 +9940,12 @@
color: var(--interactive-active);
}
${BDFDB.dotCNS.listrowwrapper + BDFDB.dotCN.listavatar} {
display: flex;
justify-content: center;
align-items: center;
}
${BDFDB.dotCN.sidebarlist} {
display: flex;
flex-direction: row;

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,10 @@
var FriendNotifications = (_ => {
var _this;
var userStatusStore, timeLog, lastTimes, friendCounter, checkInterval;
var userStatusStore, timeLog, lastTimes, friendCounter, checkInterval, paginationOffset = {};
var settings = {}, amounts = {}, notificationStrings = {}, notificationSounds = {}, observedUsers = {};
const FriendOnlineCounter = class FriendOnlineCounter extends BdApi.React.Component {
const FriendOnlineCounterComponent = class FriendOnlineCounter extends BdApi.React.Component {
componentDidMount() {
friendCounter = this;
}
@ -26,7 +26,7 @@ var FriendNotifications = (_ => {
return class FriendNotifications {
getName () {return "FriendNotifications";}
getVersion () {return "1.4.8";}
getVersion () {return "1.4.9";}
getAuthor () {return "DevilBro";}
@ -34,8 +34,7 @@ var FriendNotifications = (_ => {
constructor () {
this.changelog = {
"fixed":[["200 cap","No longer caps timelog at 200 entries"]],
"improved":[["Pagination","Added Pagination to the settings and timelog, to stop the plugin from freezing for ppl who feel like they need to have over 500 friends on discord"]]
"fixed":[["Settings Page Reset","Enabling/Disabling notifications for a user no longer jumps back the settings list to page 1"]]
};
this.patchedModules = {
@ -190,7 +189,9 @@ var FriendNotifications = (_ => {
data: users,
pagination: {
alphabetKey: "username",
amount: 50
amount: 50,
offset: paginationOffset[title] || 0,
onJump: offset => {paginationOffset[title] = offset;}
},
renderLabel: data => [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.AvatarComponents.default, {
@ -518,7 +519,7 @@ var FriendNotifications = (_ => {
processGuilds (e) {
if (settings.addOnlineCount) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ConnectedUnreadDMs"});
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(FriendOnlineCounter, {
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(FriendOnlineCounterComponent, {
amount: BDFDB.LibraryModules.StatusMetaUtils.getOnlineFriendCount()
}));
}