Skip to content

Commit 612c32d

Browse files
Merge pull request #1060 from Codeinwp/bugfix/pro/607
Added search option to find specific accounts
2 parents 1349fec + da349cc commit 612c32d

4 files changed

Lines changed: 67 additions & 13 deletions

File tree

assets/css/rop_core.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3045,6 +3045,11 @@ a.active {
30453045
-webkit-flex: 0 0 auto;
30463046
-ms-flex: 0 0 auto;
30473047
flex: 0 0 auto;
3048+
display: flex;
3049+
justify-content: space-between;
3050+
align-items: center;
3051+
border-bottom: 0.05rem solid #e7e9ed;
3052+
margin: 8px;
30483053
}
30493054

30503055
#rop_core .panel .panel-body {
@@ -3213,7 +3218,6 @@ a.active {
32133218
display: flex;
32143219
display: -ms-flexbox;
32153220
margin: 0.2rem 0 0.15rem;
3216-
border-bottom: 0.05rem solid #e7e9ed;
32173221
list-style: none;
32183222

32193223
-webkit-align-items: center;
@@ -3223,6 +3227,7 @@ a.active {
32233227
-webkit-flex-wrap: wrap;
32243228
-ms-flex-wrap: wrap;
32253229
flex-wrap: wrap;
3230+
margin-bottom: 0px;
32263231
}
32273232

32283233
#rop_core .tab .tab-item {

includes/class-rop-i18n.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public static function get_labels( $key = '' ) {
137137
'get_latest_pro_version' => __( 'Get the latest Pro version to unlock.', 'tweet-old-post' ),
138138
'tlg_app_desc' => sprintf( __( 'You can check %1$shere%2$s for how to get these details.', 'tweet-old-post' ), '<a class="text-bold " href="https://docs.revive.social/article/2223-how-to-connect-revive-social-to-telegram" target="_blank">', '</a>' ),
139139
'upsell_bz_service_body' => __( 'We\'re sorry, %1$s is not available on your plan. Please upgrade to the business plan to unlock all these features and get more traffic.', 'tweet-old-post' ),
140+
'search_account' => __( 'Search account', 'tweet-old-post' ),
141+
'no_account_found' => __( 'No account found for search', 'tweet-old-post' ),
140142
),
141143
'settings' => array(
142144
'yes_text' => __( 'Yes', 'tweet-old-post' ),

vue/src/vue-elements/accounts-tab-panel.vue

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,24 @@
2121
v-if="accountsCount === 0 && is_preloading > 0"
2222
class="empty mb-2"
2323
>
24-
<div class="empty-icon">
25-
<i class="fa fa-3x fa-user-circle-o" />
24+
<div
25+
v-if="!searchAccount"
26+
>
27+
<div class="empty-icon">
28+
<i class="fa fa-3x fa-user-circle-o" />
29+
</div>
30+
<p class="empty-title h5">
31+
{{ labels.no_accounts }}
32+
</p>
33+
<p class="empty-subtitle">
34+
{{ labels.no_accounts_desc }}
35+
</p>
36+
</div>
37+
<div
38+
v-else
39+
>
40+
{{ labels.no_account_found }}: "{{ searchAccount }}"
2641
</div>
27-
<p class="empty-title h5">
28-
{{ labels.no_accounts }}
29-
</p>
30-
<p class="empty-subtitle">
31-
{{ labels.no_accounts_desc }}
32-
</p>
3342
</div>
3443
<template v-if="is_preloading > 0">
3544
<div
@@ -109,6 +118,14 @@
109118
110119
export default {
111120
name: 'AccountView',
121+
props: {
122+
searchAccount: {
123+
default: function () {
124+
return '';
125+
},
126+
type: String
127+
}
128+
},
112129
components: {
113130
SignInBtn,
114131
ServiceUserTile,
@@ -124,15 +141,16 @@
124141
twitter_warning: false,
125142
labels: this.$store.state.labels.accounts,
126143
upsell_link: ropApiSettings.upsell_link,
127-
pro_installed: ropApiSettings.pro_installed
144+
pro_installed: ropApiSettings.pro_installed,
145+
postTimeout: ''
128146
}
129147
},
130148
computed: {
131149
/**
132150
* Get all the available/active accounts.
133151
*/
134152
accounts: function () {
135-
const all_accounts = {};
153+
let all_accounts = {};
136154
let twitter = 0;
137155
const services = this.$store.state.authenticatedServices;
138156
for (const key in services) {
@@ -150,6 +168,9 @@
150168
}
151169
}
152170
}
171+
if (this.searchAccount){
172+
all_accounts = this.filteredAccounts(all_accounts);
173+
}
153174
this.twitter_warning = twitter > 1;
154175
this.$log.info('All accounts: ', all_accounts);
155176
this.$log.debug('Preloading: ', this.$store.state.hide_preloading);
@@ -206,6 +227,21 @@
206227
this.is_loading = false;
207228
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
208229
})
230+
},
231+
filteredAccounts: function(accounts) {
232+
const result = {};
233+
const query = this.searchAccount?.toLowerCase() || '';
234+
235+
for (const account_id in accounts) {
236+
const account = accounts[account_id];
237+
if (
238+
account?.user &&
239+
account.user.toLowerCase().includes(query)
240+
) {
241+
result[account_id] = account;
242+
}
243+
}
244+
return result;
209245
}
210246
}
211247
}

vue/src/vue-elements/main-page-panel.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
<div
7171
v-if="is_preloading_over > 0"
7272
class="panel-nav"
73-
style="padding: 8px;"
7473
>
7574
<ul class="tab ">
7675
<li
@@ -87,10 +86,20 @@
8786
>{{ tab.name }}</a>
8887
</li>
8988
</ul>
89+
<div class="search-accounts">
90+
<input
91+
v-model="searchAccount"
92+
type="text"
93+
name="search-accounts"
94+
:placeholder="search_account"
95+
class="form-input"
96+
/>
97+
</div>
9098
</div>
9199
<component
92100
:is="page.template"
93101
:type="page.view"
102+
:search-account="searchAccount"
94103
/>
95104
</div>
96105

@@ -258,7 +267,9 @@
258267
license_data_view: this.$store.state.licenseDataView,
259268
license_field_title: window.wp.i18n.sprintf(this.$store.state.labels.general.license_product, 'Revive Old Posts Pro Add-on'),
260269
license_error: false,
261-
password_mask: this.$store.state.licenseDataView?.passwordMask
270+
password_mask: this.$store.state.licenseDataView?.passwordMask,
271+
search_account: this.$store.state.labels.accounts.search_account,
272+
searchAccount: ''
262273
}
263274
},
264275
computed: {

0 commit comments

Comments
 (0)