summaryrefslogtreecommitdiffstats
path: root/src/App.vue
blob: 984a0d0f308355427d7d408ebdd9bf629d0ef76f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<template>
	<div id="content" class="app-social">
		<div id="app-navigation">
			<app-navigation :menu="menu"></app-navigation>
		</div>
		<div id="app-content">
			<div class="social__container">
				<div class="social__welcome">
					<a class="close icon-close" href="#"><span class="hidden-visually">Close</span></a>
					<h3>🎉{{ t('social', 'Nextcloud becomes part of the federated social networks!') }}</h3>
					<p>
						{{ t('social', 'We have automatically created a social account for you. Your social id is the same as the federated cloud id:') }}
						<span class="social-id">{{ socialId }}</span>
					</p>
				</div>
				<div class="social__timeline">
					<div class="new-post" data-id="">
						<div class="new-post-author">
							<div class="avatar currentUser" data-username="admin"><img src="/index.php/avatar/admin/32?v=1" alt=""></div>
						</div>
						<form class="new-post-form">
							<div class="author currentUser">Julius Haertl</div>
							<div contenteditable="true" class="message" data-placeholder="New comment …"></div>
							<input class="submit icon-confirm has-tooltip" type="submit" value="" title="" data-original-title="Post">
							<div class="submitLoading icon-loading-small hidden"></div>
						</form>
					</div>
					<timeline-entry v-for="entry in timeline" :key="entry.id" :item="entry"></timeline-entry>
				</div>
			</div>
		</div>
	</div>
</template>

<style scoped>
	.social__welcome {
		padding: 15px;
		background-color: var(--color-background-dark);
	}

	.social__welcome h3 {
		margin-top: 0;
	}

	.social__welcome .icon-close {
		float:right;
	}

	.social-id {
		font-weight: bold;
	}
	.new-post {
		display: flex;
		padding: 10px;
		border-bottom: 1px solid var(--color-background-dark);

	}
	.new-post-author {
		padding: 5px;
	}
	.new-post-form {
		flex-grow: 1;
		position: relative;
	}
	.message {
		width: 100%;
	}
	input[type=submit] {
		width: 44px;
		height: 44px;
		margin: 0;
		padding: 13px;
		background-color: transparent;
		border: none;
		opacity: 0.3;
		position: absolute;
		bottom: 0;
		right: 0;
	}
</style>


<script>
	import {
		PopoverMenu,
		AppNavigation
	} from 'nextcloud-vue';
	import TimelineEntry from './components/TimelineEntry';

	export default {
		name: 'App',
		components: {
			PopoverMenu, AppNavigation, TimelineEntry
		},
		data: function () {
			return {

			};
		},
		beforeMount: function() {
			let example = {
				message: 'Want to #DropDropbox? #DeleteGoogle? #decentralize? We got you covered, easy as a piece of 🥞\n' +
					'\n' +
					'Get started right now: https://nextcloud.com/signup',
				author: 'Nextcloud 📱☁️💻',
				authorId: '@nextcloud@mastodon.xyz',
				authorAvatar: OC.linkTo('social', 'img/nextcloud.png'),
				timestamp: '1 day ago'
			};
			let data = [];
			for (let i=0; i<20; i++) {
				example.id = Math.floor((Math.random() * 100));
				data.push(example);
			}
			this.$store.commit('addToTimeline', data);
		},
		computed: {
			socialId: function() {
				return '@' + OC.getCurrentUser().uid + '@' + OC.getHost();
			},
			timeline: function() {
				return this.$store.getters.getTimeline;
			},
			menu: function () {
				let defaultCategories = [
					{
						id: 'social-timeline',
						classes: [],
						href: '#',
						icon: 'icon-category-monitoring',
						text: t('social', 'Timeline'),
					},
					{
						id: 'social-your-posts',
						classes: [],
						href: '#',
						icon: 'icon-user',
						text: t('social', 'Your posts'),
					},
					{
						id: 'social-friends',
						classes: [],
						href: '#',
						icon: 'icon-category-social',
						text: t('social', 'Friends'),
					},
					{
						id: 'social-favorites',
						classes: [],
						href: '#',
						icon: 'icon-favorite',
						text: t('social', 'Favorites'),
					},
					{
						id: 'social-direct-messages',
						classes: [],
						href: '#',
						icon: 'icon-comment',
						utils: {
							counter: 3,
						},
						text: t('social', 'Direct messages'),
					},
				];
				return {
					items: defaultCategories,
					loading: false
				}
			}
		}
	}
</script>