Skip to content

Commit 4bb04f4

Browse files
authored
feat(ccleaf): add activity (#10718)
1 parent 7830b16 commit 4bb04f4

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

websites/C/ccLeaf/metadata.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://schemas.premid.app/metadata/1.16",
3+
"apiVersion": 1,
4+
"author": {
5+
"id": "1028528977410797628",
6+
"name": "th3wwt"
7+
},
8+
"service": "ccLeaf",
9+
"description": {
10+
"en": "ccLeaf is an animation template platform where creators can quickly edit and export high-quality visuals without doing everything from scratch. It’s built for speed, simplicity, and clean results."
11+
},
12+
"url": ["ccleaf.com", "app.ccleaf.com"],
13+
"regExp": "^https?[:][/][/]([a-z0-9-]+[.])*ccleaf[.]com[/]",
14+
"version": "1.0.0",
15+
"logo": "https://i.imgur.com/fv1VJQR.png",
16+
"thumbnail": "https://i.imgur.com/qhIVv23.png",
17+
"color": "#000000",
18+
"category": "other",
19+
"tags": [
20+
"animation"
21+
]
22+
}

websites/C/ccLeaf/presence.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const presence = new Presence({
2+
clientId: '1498049243368390736',
3+
})
4+
5+
const browsingTimestamp = Math.floor(Date.now() / 1000)
6+
7+
presence.on('UpdateData', async () => {
8+
const path = document.location.pathname
9+
10+
let details = 'Using ccLeaf'
11+
let state = 'In the app'
12+
13+
if (path === '/') {
14+
details = 'Viewing homepage'
15+
state = 'Exploring ccLeaf'
16+
}
17+
else if (path === '/animations') {
18+
details = 'Browsing animations'
19+
state = 'Selecting a template'
20+
}
21+
else if (/^\/animations\/\d+\/.+/.test(path)) {
22+
const animationSlug = path.match(/^\/animations\/\d+\/(.+)$/)?.[1]
23+
24+
if (animationSlug) {
25+
const animationName = animationSlug
26+
.replace(/-/g, ' ')
27+
.replace(/\b\w/g, c => c.toUpperCase())
28+
29+
details = 'Editing animation'
30+
state = animationName
31+
}
32+
}
33+
34+
presence.setActivity({
35+
details,
36+
state,
37+
startTimestamp: browsingTimestamp,
38+
largeImageKey: 'https://i.imgur.com/fv1VJQR.png',
39+
})
40+
})

0 commit comments

Comments
 (0)