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

File diff suppressed because one or more lines are too long

View File

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