frontend
Start work on formatter for content
This commit is contained in:
parent
1dbdec1905
commit
c7af216ce3
30 changed files with 292 additions and 22 deletions
|
@ -3,6 +3,7 @@
|
|||
<Note::UserHeader
|
||||
@displayname="{{@note.displayname}}"
|
||||
@handle="@{{@note.username}}@{{@note.server}}"
|
||||
@server="{{@note.servertype}}"
|
||||
/>
|
||||
<Note::Content @content="{{@note.content}}" />
|
||||
<div class="note-timestamps-container">
|
||||
|
|
15
frontend-reactive/app/components/note/formatter.hbs
Normal file
15
frontend-reactive/app/components/note/formatter.hbs
Normal file
|
@ -0,0 +1,15 @@
|
|||
<div class="{{ @classes }}">
|
||||
{{#if (equals @server "mastodon")}}
|
||||
<Note::Formatter::Mastodon>{{ @content }}Masto</Note::Formatter::Mastodon>
|
||||
{{else if (equals @server "misskey")}}
|
||||
<Note::Formatter::Misskey>{{ @content }}Misskey</Note::Formatter::Misskey>
|
||||
{{else if (equals @server "akoma")}}
|
||||
<Note::Formatter::Akoma>{{ @content }}Akoma</Note::Formatter::Akoma>
|
||||
{{else if (equals @server "linstrom")}}
|
||||
<Note::Formatter::Linstrom>{{ @content }}Linstrom</Note::Formatter::Linstrom>
|
||||
{{else if (equals @server "wafrn")}}
|
||||
<Note::Formatter::Wafrn>{{ @content }}Wafrn</Note::Formatter::Wafrn>
|
||||
{{else}}
|
||||
<Note::Formatter::Linstrom>{{ @content }}Unkown:{{@server}}</Note::Formatter::Linstrom>
|
||||
{{/if}}
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
{{yield}}
|
14
frontend-reactive/app/components/note/formatter/akoma.ts
Normal file
14
frontend-reactive/app/components/note/formatter/akoma.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Component from '@glimmer/component';
|
||||
|
||||
export interface NoteFormatterAkomaSignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {};
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: [];
|
||||
};
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null;
|
||||
}
|
||||
|
||||
export default class NoteFormatterAkoma extends Component<NoteFormatterAkomaSignature> {}
|
|
@ -0,0 +1 @@
|
|||
{{yield}}
|
14
frontend-reactive/app/components/note/formatter/linstrom.ts
Normal file
14
frontend-reactive/app/components/note/formatter/linstrom.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Component from '@glimmer/component';
|
||||
|
||||
export interface NoteFormatterLinstromSignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {};
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: [];
|
||||
};
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null;
|
||||
}
|
||||
|
||||
export default class NoteFormatterLinstrom extends Component<NoteFormatterLinstromSignature> {}
|
|
@ -0,0 +1 @@
|
|||
{{yield}}
|
14
frontend-reactive/app/components/note/formatter/mastodon.ts
Normal file
14
frontend-reactive/app/components/note/formatter/mastodon.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Component from '@glimmer/component';
|
||||
|
||||
export interface NoteFormatterMastodonSignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {};
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: [];
|
||||
};
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null;
|
||||
}
|
||||
|
||||
export default class NoteFormatterMastodon extends Component<NoteFormatterMastodonSignature> {}
|
|
@ -0,0 +1 @@
|
|||
{{yield}}
|
14
frontend-reactive/app/components/note/formatter/misskey.ts
Normal file
14
frontend-reactive/app/components/note/formatter/misskey.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Component from '@glimmer/component';
|
||||
|
||||
export interface NoteFormatterMisskeySignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {};
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: [];
|
||||
};
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null;
|
||||
}
|
||||
|
||||
export default class NoteFormatterMisskey extends Component<NoteFormatterMisskeySignature> {}
|
|
@ -0,0 +1 @@
|
|||
{{yield}}
|
14
frontend-reactive/app/components/note/formatter/wafrn.ts
Normal file
14
frontend-reactive/app/components/note/formatter/wafrn.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Component from '@glimmer/component';
|
||||
|
||||
export interface NoteFormatterWafrnSignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {};
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: [];
|
||||
};
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null;
|
||||
}
|
||||
|
||||
export default class NoteFormatterWafrn extends Component<NoteFormatterWafrnSignature> {}
|
|
@ -3,7 +3,8 @@
|
|||
<p>Pfp</p>
|
||||
</div>
|
||||
<div class="note-user-name-and-handle">
|
||||
<p class="note-user-displayname">{{@displayname}}</p>
|
||||
<Note::Formatter @classes="note-user-displayname" @content={{@displayname}} @server={{@server}}/>
|
||||
<p class="note-user-displayname"></p>
|
||||
<p class="note-user-handle">{{@handle}}</p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
<div class="timeline">
|
||||
{{#each @notes as |note|}}
|
||||
<Note @isInTimeline="true" @note={{note}}/>
|
||||
<hr class="timeline-separator">
|
||||
{{/each}}
|
||||
</div>
|
6
frontend-reactive/app/helpers/equals.ts
Normal file
6
frontend-reactive/app/helpers/equals.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
export default helper(function equals(args) {
|
||||
if (args.length != 2) return false;
|
||||
return args[0] == args[1];
|
||||
});
|
|
@ -19,6 +19,7 @@ export default class ApplicationRoute extends Route {
|
|||
content: 'lorem ipsum',
|
||||
createdAt: Date.now() - 360000,
|
||||
editedAt: Date.now() - 60000,
|
||||
servertype: 'mastodon',
|
||||
},
|
||||
{
|
||||
displayname: 'Melody',
|
||||
|
@ -27,6 +28,7 @@ export default class ApplicationRoute extends Route {
|
|||
content:
|
||||
'Grapple keel reef fathom haul wind bilge rat swing the lead belay line pink. Man-of-war mizzenmast killick lookout yo-ho-ho Sail ho gabion careen sutler stern. Draught wherry lookout schooner prow hail-shot spanker Letter of Marque lateen sail strike colors.\n\nLad heave to topgallant scallywag scuppers Spanish Main poop deck spike hulk broadside. Snow take a caulk hornswaggle gaff swab quarter lugger spanker bilge provost. Man-of-war measured fer yer chains lugger cable loaded to the gunwalls prow piracy snow doubloon furl.\n\nDead men tell no tales jib chase guns gunwalls Gold Road smartly nipperkin topsail bilge water Pirate Round. Gaff gunwalls bilged on her anchor bilge water scourge of the seven seas parley ho sheet chase guns squiffy. Scuppers fathom ho quarter gally heave to yardarm coxswain red ensign pink.',
|
||||
createdAt: Date.now() - 3600,
|
||||
servertype: 'linstrom',
|
||||
},
|
||||
{
|
||||
displayname: 'alice',
|
||||
|
@ -35,6 +37,7 @@ export default class ApplicationRoute extends Route {
|
|||
content: 'lorem ipsum',
|
||||
createdAt: Date.now() - 360000,
|
||||
editedAt: Date.now() - 60000,
|
||||
servertype: 'wafrn',
|
||||
},
|
||||
{
|
||||
displayname: 'Melody',
|
||||
|
@ -43,6 +46,7 @@ export default class ApplicationRoute extends Route {
|
|||
content:
|
||||
'Grapple keel reef fathom haul wind bilge rat swing the lead belay line pink. Man-of-war mizzenmast killick lookout yo-ho-ho Sail ho gabion careen sutler stern. Draught wherry lookout schooner prow hail-shot spanker Letter of Marque lateen sail strike colors.\n\nLad heave to topgallant scallywag scuppers Spanish Main poop deck spike hulk broadside. Snow take a caulk hornswaggle gaff swab quarter lugger spanker bilge provost. Man-of-war measured fer yer chains lugger cable loaded to the gunwalls prow piracy snow doubloon furl.\n\nDead men tell no tales jib chase guns gunwalls Gold Road smartly nipperkin topsail bilge water Pirate Round. Gaff gunwalls bilged on her anchor bilge water scourge of the seven seas parley ho sheet chase guns squiffy. Scuppers fathom ho quarter gally heave to yardarm coxswain red ensign pink.',
|
||||
createdAt: Date.now() - 3600,
|
||||
servertype: 'unknown',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import Service from '@ember/service'
|
||||
|
||||
export default class AuthenticationService extends Service {}
|
||||
|
||||
// Don't remove this declaration: this is what enables TypeScript to resolve
|
||||
// this service using `Owner.lookup('service:authentication')`, as well
|
||||
// as to check when you pass the service name as an argument to the decorator,
|
||||
// like `@service('authentication') declare altName: AuthenticationService;`.
|
||||
declare module '@ember/service' {
|
||||
interface Registry {
|
||||
authentication: AuthenticationService
|
||||
}
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */
|
||||
|
||||
/* @import url("debug.css"); */
|
||||
@import url("fonts.css");
|
||||
@import url("colors.css");
|
||||
@import url("notes.css");
|
||||
@import url("util.css");
|
||||
@import url("svgs.css");
|
||||
@import url("timeline.css");
|
||||
@import url("auth.css");
|
||||
|
|
0
frontend-reactive/app/styles/auth.css
Normal file
0
frontend-reactive/app/styles/auth.css
Normal file
3
frontend-reactive/app/styles/debug.css
Normal file
3
frontend-reactive/app/styles/debug.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
* {
|
||||
border: red 1px dashed;
|
||||
}
|
|
@ -6,12 +6,12 @@
|
|||
height: fit-content;
|
||||
|
||||
/* align-items: center; */
|
||||
border: 1px dashed red;
|
||||
|
||||
/* max-width: 50em; */
|
||||
padding: 0.5em;
|
||||
background-color: var(--background-100);
|
||||
color: var(--text);
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
.note-user-header {
|
||||
|
@ -23,7 +23,6 @@
|
|||
}
|
||||
|
||||
.note-user-pfp {
|
||||
border: 1px dashed red;
|
||||
width: 3em;
|
||||
height: 3em;
|
||||
padding-bottom: 0.1em;
|
||||
|
@ -44,7 +43,7 @@
|
|||
}
|
||||
|
||||
.note-user-handle {
|
||||
/* font-size: 85%; */
|
||||
font-size: 0.8em;
|
||||
color: #555;
|
||||
margin: 0;
|
||||
}
|
||||
|
@ -55,7 +54,7 @@
|
|||
}
|
||||
|
||||
.note-timestamp {
|
||||
/* font-size: 0.8em; */
|
||||
font-size: 0.8em;
|
||||
margin: -0.1em;
|
||||
color: var(--text-700);
|
||||
}
|
||||
|
@ -65,11 +64,9 @@
|
|||
flex-direction: column;
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
border: 1px dashed red;
|
||||
}
|
||||
|
||||
.note-content-text {
|
||||
border: 1px dashed red;
|
||||
margin-top: -0.08em;
|
||||
margin-bottom: -0.08em;
|
||||
padding: 0.2em;
|
||||
|
@ -80,7 +77,7 @@
|
|||
margin-bottom: 0.3em;
|
||||
cursor: pointer;
|
||||
background-color: var(--secondary-300);
|
||||
padding: 0.1em 0.3em 0.2em;
|
||||
padding: 0.1em 0.3em;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
|
@ -93,7 +90,7 @@
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-top: 1px solid black;
|
||||
border-top: 1px solid var(--text-300);
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,3 +5,7 @@
|
|||
scroll-behavior: smooth;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.timeline-separator {
|
||||
color: var(--text-400);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter>
|
||||
template block text
|
||||
</Note::Formatter>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter/akoma', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter::Akoma />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter::Akoma>
|
||||
template block text
|
||||
</Note::Formatter::Akoma>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter/linstrom', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter::Linstrom />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter::Linstrom>
|
||||
template block text
|
||||
</Note::Formatter::Linstrom>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter/mastodon', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter::Mastodon />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter::Mastodon>
|
||||
template block text
|
||||
</Note::Formatter::Mastodon>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter/misskey', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter::Misskey />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter::Misskey>
|
||||
template block text
|
||||
</Note::Formatter::Misskey>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,26 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | note/formatter/wafrn', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
// Set any properties with this.set('myProperty', 'value');
|
||||
// Handle any actions with this.set('myAction', function(val) { ... });
|
||||
|
||||
await render(hbs`<Note::Formatter::Wafrn />`);
|
||||
|
||||
assert.dom().hasText('');
|
||||
|
||||
// Template block usage:
|
||||
await render(hbs`
|
||||
<Note::Formatter::Wafrn>
|
||||
template block text
|
||||
</Note::Formatter::Wafrn>
|
||||
`);
|
||||
|
||||
assert.dom().hasText('template block text');
|
||||
});
|
||||
});
|
17
frontend-reactive/tests/integration/helpers/equals-test.ts
Normal file
17
frontend-reactive/tests/integration/helpers/equals-test.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'frontend-reactive/tests/helpers';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Helper | equals', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it renders', async function (assert) {
|
||||
this.set('inputValue', '1234');
|
||||
|
||||
await render(hbs`{{equals this.inputValue}}`);
|
||||
|
||||
assert.dom().hasText('1234');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue