misc: tweak placeholders
This commit is contained in:
4 files changed
+31
-19
No files matched your search
@@ -330,7 +330,7 @@
|
|||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
label={$t('form.post.body')}
|
label={$t('form.post.body')}
|
||||||
bind:value={data.body}
|
bind:value={data.body}
|
||||||
placeholder={placeholders.get('post')}
|
placeholder={placeholders.get('body')}
|
||||||
previewButton
|
previewButton
|
||||||
/>
|
/>
|
||||||
{#if data.url !== undefined}
|
{#if data.url !== undefined}
|
||||||
|
|||||||
@@ -912,5 +912,10 @@
|
|||||||
"stats": {
|
"stats": {
|
||||||
"joined": "Joined",
|
"joined": "Joined",
|
||||||
"created": "Created"
|
"created": "Created"
|
||||||
|
},
|
||||||
|
"placeholders": {
|
||||||
|
"title": "Add a post title",
|
||||||
|
"body": "What do you have to say?",
|
||||||
|
"comments": "Join the conversation"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ export const defaultSettings: Settings = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
randomPlaceholders: toBool(env.PUBLIC_RANDOM_PLACEHOLDERS) ?? true,
|
randomPlaceholders: toBool(env.PUBLIC_RANDOM_PLACEHOLDERS) ?? false,
|
||||||
modlogCardView: toBool(env.PUBLIC_MODLOG_CARD_VIEW) ?? undefined,
|
modlogCardView: toBool(env.PUBLIC_MODLOG_CARD_VIEW) ?? undefined,
|
||||||
debugInfo: toBool(env.PUBLIC_DEBUG_INFO) ?? false,
|
debugInfo: toBool(env.PUBLIC_DEBUG_INFO) ?? false,
|
||||||
expandImages: toBool(env.PUBLIC_EXPAND_IMAGES) ?? true,
|
expandImages: toBool(env.PUBLIC_EXPAND_IMAGES) ?? true,
|
||||||
|
|||||||
+24
-17
@@ -7,6 +7,7 @@ import { page } from '$app/state'
|
|||||||
import { feature } from '$lib/version.js'
|
import { feature } from '$lib/version.js'
|
||||||
import { client } from '$lib/lemmy.js'
|
import { client } from '$lib/lemmy.js'
|
||||||
import { site } from './lemmy'
|
import { site } from './lemmy'
|
||||||
|
import { t } from './translations'
|
||||||
|
|
||||||
// Despite the name, this will round up
|
// Despite the name, this will round up
|
||||||
// Example: findClosestNumber([8, 16, 32, 64, 128], 76) will return 128
|
// Example: findClosestNumber([8, 16, 32, 64, 128], 76) will return 128
|
||||||
@@ -32,32 +33,38 @@ export const fullCommunityName = (name: string, actorId: string) =>
|
|||||||
`${name}@${new URL(actorId).hostname}`
|
`${name}@${new URL(actorId).hostname}`
|
||||||
|
|
||||||
export const placeholders = {
|
export const placeholders = {
|
||||||
url: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
|
url: ['https://example.com'],
|
||||||
post: [
|
post: [
|
||||||
'Is starting nuclear warfare illegal?',
|
'Does anybody read these placeholders?',
|
||||||
"AITA for making somebody's day?",
|
'Top 10 reasons why a meteor would help Earth',
|
||||||
'BREAKING NEWS: Police break into gun shop, find weapons',
|
'Title text',
|
||||||
'How do I make sure my pet rock stays alive?',
|
'I took a picture of something idk',
|
||||||
'My cat just invented a time machine, what do I do?',
|
|
||||||
'Unpopular opinion: world peace would be beneficial to humanity',
|
|
||||||
'LPT: The smaller weights are easier to lift than the bigger weights in a gym',
|
|
||||||
'ELI5: What is 4 + 8?',
|
|
||||||
],
|
],
|
||||||
|
body: ['bottom text', 'body text', 'body text'],
|
||||||
comment: [
|
comment: [
|
||||||
'what?',
|
'what?',
|
||||||
'new response just dropped',
|
'new response just dropped',
|
||||||
"i did not read this post at all and i'm about to give my opinion on it.",
|
|
||||||
'this comment placeholder is very important dont forget',
|
'this comment placeholder is very important dont forget',
|
||||||
'huh. i did not understand any of that.',
|
|
||||||
'existential crisis in progress',
|
'existential crisis in progress',
|
||||||
'hello user i am a sentient placeholder. please dont type anything or i disappear forever. thanks',
|
'hello user i am a sentient placeholder. please dont type anything or i disappear forever. thanks',
|
||||||
],
|
],
|
||||||
get: (type: 'url' | 'post' | 'comment') => {
|
get: (type: 'url' | 'post' | 'body' | 'comment') => {
|
||||||
return settings.randomPlaceholders
|
if (settings.randomPlaceholders) {
|
||||||
? placeholders[type][
|
return placeholders[type][
|
||||||
Math.floor(Math.random() * placeholders[type].length)
|
Math.floor(Math.random() * placeholders[type].length)
|
||||||
]
|
]
|
||||||
: ''
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'post':
|
||||||
|
return t.get('placeholders.title')
|
||||||
|
case 'body':
|
||||||
|
return t.get('placeholders.body')
|
||||||
|
case 'comment':
|
||||||
|
return t.get('placeholders.comments')
|
||||||
|
case 'url':
|
||||||
|
return 'https://example.com'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user