Skip to content

Commit ceb9114

Browse files
author
Ajit Kumar
committed
fix(showing all plugins everywhere, get schema)
1 parent c86c35b commit ceb9114

File tree

13 files changed

+188
-24
lines changed

13 files changed

+188
-24
lines changed

client/components/adsense.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import DotsLoading from './dots';
2+
3+
const nameMap = {
4+
plugin: {
5+
slot: '5581360041',
6+
layout: '',
7+
layoutKey: '-eg+0+3d-4r-3z',
8+
},
9+
readme: {
10+
slot: '9580584302',
11+
layout: 'in-article',
12+
layoutKey: '',
13+
},
14+
};
15+
16+
/**
17+
* AdSense component for displaying Google AdSense ads.
18+
* @param {object} props
19+
* @param {string} [props.className='']
20+
* @param {keyof typeof nameMap} [props.name='']
21+
* @param {StyleList} [props.style={}]
22+
* @param {Ref} [props.ref=Ref()]
23+
* @returns
24+
*/
25+
export default function AdSense({ className = '', name = 'plugin', style = {}, ref }) {
26+
setTimeout(() => {
27+
window.adsbygoogle.push({});
28+
}, 0);
29+
30+
return (
31+
<div className={className} style={{ zIndex: '1', ...style }} ref={ref}>
32+
<ins
33+
className='adsbygoogle'
34+
style={{ display: 'block', zIndex: 1 }}
35+
data-ad-client='ca-pub-5911839694379275'
36+
data-ad-slot={nameMap[name].slot}
37+
data-ad-format='fluid'
38+
data-full-width-responsive='true'
39+
data-ad-layout={nameMap[name].layout}
40+
data-ad-layout-key={nameMap[name].layoutKey}
41+
/>
42+
<DotsLoading style={{ zIndex: 0 }} />
43+
</div>
44+
);
45+
}

client/components/dots/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import './style.scss';
2+
3+
/**
4+
* Loading component that displays three dots to indicate loading state.
5+
* @param {object} props
6+
* @param {StyleList} [props.style={}]
7+
* @returns
8+
*/
9+
export default function DotsLoading({ style }) {
10+
return (
11+
<div className='dots-loading' style={style}>
12+
<span className='dot' />
13+
<span className='dot' />
14+
<span className='dot' />
15+
</div>
16+
);
17+
}

client/components/dots/style.scss

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.dots-loading {
2+
position: absolute;
3+
top: 0;
4+
left: 0;
5+
width: 100%;
6+
height: 100%;
7+
display: flex;
8+
justify-content: center;
9+
align-items: center;
10+
11+
.dot {
12+
width: 15px;
13+
height: 15px;
14+
border-radius: 50%;
15+
margin: 0 5px;
16+
animation: dots 1s infinite;
17+
}
18+
19+
:nth-child(1) {
20+
background-color: red;
21+
animation: dots 1s infinite;
22+
}
23+
24+
:nth-child(2) {
25+
background-color: green;
26+
animation: dots 1s infinite 0.2s;
27+
}
28+
29+
:nth-child(3) {
30+
background-color: blue;
31+
animation: dots 1s infinite 0.4s;
32+
}
33+
34+
@keyframes dots {
35+
0% {
36+
transform: translateY(0);
37+
opacity: 1;
38+
}
39+
40+
50% {
41+
transform: translateY(-10px);
42+
opacity: 0.5;
43+
}
44+
45+
100% {
46+
transform: translateY(0);
47+
opacity: 1;
48+
}
49+
}
50+
}

client/components/plugins/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import AdSense from 'components/adsense';
12
import './style.scss';
23
import alert from 'components/dialogs/alert';
34
import confirm from 'components/dialogs/confirm';
45
import prompt from 'components/dialogs/prompt';
56
import select from 'components/dialogs/select';
7+
import DotsLoading from 'components/dots';
68
import Router from 'lib/Router';
79
import { calcRating, capitalize, getLoggedInUser, hideLoading, showLoading } from 'lib/helpers';
810

@@ -30,6 +32,9 @@ export default function Plugins({ user, orderBy, status, name }) {
3032

3133
el.setAttribute('data-msg', 'No plugins found. :(');
3234
for (const plugin of plugins) {
35+
if (Math.random() < 0.1) {
36+
el.append(<AdSense className='plugin' style={{ position: 'relative' }} />);
37+
}
3338
el.append(<Plugin {...plugin} isAdmin={isAdmin} userId={userId} />);
3439
}
3540
} catch (error) {

client/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ window.onload = async () => {
2525
{ href: '/faqs', text: 'FAQs' },
2626
{ href: 'https://docs.acode.app', text: 'Plugin Docs' },
2727
{ href: '/plugins', text: 'Plugins' },
28-
{ href: 'https://www.foxbiz.io', text: 'Foxbiz' },
29-
{ href: '/policy', text: 'Privacy policy' },
30-
{ href: '/terms', text: 'Terms of service' },
3128
{ href: '/user', text: $loginText, icon: 'person' },
3229
]}
3330
/>

client/main.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ header {
133133
display: none;
134134
}
135135

136-
@media screen and (max-width: 1110px) {
136+
@media screen and (max-width: 600px) {
137137
label[for='menu-toggler'] {
138138
display: flex;
139139
height: 40px;
@@ -214,6 +214,7 @@ header {
214214
height: fit-content;
215215
width: 100%;
216216
padding: 0;
217+
margin: 0;
217218
}
218219

219220
&.logo {
@@ -441,4 +442,23 @@ code {
441442
[role='button'] {
442443
cursor: pointer;
443444
width: fit-content;
445+
}
446+
447+
.footer-nav {
448+
display: flex;
449+
gap: 14px;
450+
justify-content: center;
451+
padding: 10px;
452+
flex-wrap: wrap;
453+
454+
a {
455+
color: white;
456+
margin: 0;
457+
white-space: nowrap;
458+
}
459+
}
460+
461+
footer {
462+
position: relative;
463+
z-index: 100;
444464
}

client/main.view.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ export default ({ routes }) => (
2020
{icon && <span className={`icon ${icon}`} />} {text}
2121
</a>
2222
))}
23-
<a
24-
target='_blank'
25-
style={{ color: '#0080FF', margin: '10px 0' }}
26-
href='https://www.digitalocean.com/?refcode=ddb6c70b077b&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge'
27-
rel='noreferrer'
28-
>
29-
<img height='30' src={digitalOceanLogo} alt='' />
30-
<span style={{ marginLeft: '10px' }}>
31-
<small>Powered by</small> <br />
32-
<big>DigitalOcean</big>
33-
</span>
34-
</a>
3523
</nav>
3624
<nav>
3725
<a
@@ -48,7 +36,26 @@ export default ({ routes }) => (
4836
</header>
4937
<main />
5038
<footer>
51-
<div style={{ background: 'transparent', textAlign: 'center', padding: '10px' }}>&copy; foxdebug 2023</div>
39+
<div style={{ background: 'transparent', textAlign: 'center', padding: '10px' }}>&copy; Foxbiz Software Pvt. Ltd. (2025-26)</div>
40+
<nav className='footer-nav'>
41+
<a href='https://foxbiz.io'>Foxbiz Software Pvt. Ltd.</a>
42+
<a href='/policy'>Privacy policy</a>
43+
<a href='/terms'>Terms of service</a>
44+
</nav>
45+
<nav style={{ textAlign: 'center' }}>
46+
<a
47+
target='_blank'
48+
style={{ color: '#0080FF', margin: '10px 0', textDecoration: 'none', display: 'inline-flex', alignItems: 'center' }}
49+
href='https://www.digitalocean.com/?refcode=ddb6c70b077b&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge'
50+
rel='noreferrer'
51+
>
52+
<img height='30' src={digitalOceanLogo} alt='' />
53+
<div style={{ marginLeft: '10px', display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
54+
<span style={{ fontSize: '0.7rem' }}>Powered by</span>
55+
<span>DigitalOcean</span>
56+
</div>
57+
</a>
58+
</nav>
5259
</footer>
5360
</>
5461
);

client/pages/home/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export default async function home() {
3535
Acode - An extensible and <br /> powerful code editor for Android
3636
</h1>
3737
<div className='gh-buttons'>
38-
<GhButton icon='star' url='https://github.com/deadlyjack/acode' title='Star' />
39-
<GhButton icon='repo-forked' url='https://github.com/deadlyjack/acode/fork' title='Fork' />
38+
<GhButton icon='star' url='https://github.com/acode-foundation/acode' title='Star' />
39+
<GhButton icon='repo-forked' url='https://github.com/acode-foundation/acode/fork' title='Fork' />
4040
</div>
4141
<div className='preview-image'>
4242
<img src={previewImage} alt='Acode for android' />

client/pages/plugin/index.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import './style.scss';
22
import MonthSelect from 'components/MonthSelect';
33
import YearSelect from 'components/YearSelect';
4+
import AdSense from 'components/adsense';
45
import AjaxForm from 'components/ajaxForm';
56
import alert from 'components/dialogs/alert';
67
import confirm from 'components/dialogs/confirm';
@@ -47,7 +48,12 @@ export default async function Plugin({ id: pluginId, section = 'description' })
4748
const selectYear = Ref();
4849
const selectMonth = Ref();
4950
const $comments = <CommentsContainerAndForm listRef={commentListRef} plugin={plugin} user={user} id={pluginId} userComment={userComment} />;
50-
const $description = <p className='md' innerHTML={marked.parse(description)} />;
51+
const $description = (
52+
<article style={{ width: '100%', overflow: 'auto' }}>
53+
<AdSense name='readme' style={{ position: 'relative' }} />
54+
<p className='md' innerHTML={marked.parse(description)} />
55+
</article>
56+
);
5157
const updateOrder = () => {
5258
renderOrders(ordersList, pluginId, selectYear.value, selectMonth.value);
5359
};
@@ -466,6 +472,18 @@ function CommentsContainerAndForm({ plugin, listRef, user, id, userComment }) {
466472
}
467473
}
468474

475+
/**
476+
* Renders an icon input element with customizable icon states and selection behavior.
477+
*
478+
* @param {Object} props - The properties for this component.
479+
* @param {string} props.name - The name attribute of the input, used for grouping.
480+
* @param {string} props.icon - The default icon class to display.
481+
* @param {string} props.iconSelected - The icon class to display when selected.
482+
* @param {string} props.value - The value attribute of the input.
483+
* @param {string} props.title - The title attribute used for the label and input.
484+
* @param {boolean} props.checked - Whether the input is initially checked.
485+
* @returns {HTMLElement} The rendered icon-based radio input component.
486+
*/
469487
function IconInput({ name, icon, iconSelected, value, title, checked }) {
470488
const input = Ref();
471489
const iconHolder = Ref();
@@ -509,6 +527,12 @@ function IconInput({ name, icon, iconSelected, value, title, checked }) {
509527
);
510528
}
511529

530+
/**
531+
* Toggles the flagged state of the provided element by updating its class name and title.
532+
*
533+
* @param {boolean} flagged - Indicates whether the element should be set as flagged.
534+
* @param {HTMLElement} flagRef - A reference to the HTML element that needs its class and title updated.
535+
*/
512536
function toggleFlag(flagged, flagRef) {
513537
if (flagged) {
514538
flagRef.className = 'icon flag danger';

client/pages/user/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default async function User({ userId }) {
9898
{isSelf ? <a href='/publish'>Publish Plugin</a> : ''}
9999
</div>
100100
</div>
101-
<Plugins user={userId} />
101+
<Plugins user={user.id} />
102102
</section>
103103
);
104104

0 commit comments

Comments
 (0)