Skip to content

Commit

Permalink
✨ V2
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycali committed Sep 13, 2017
1 parent e7168ea commit a503778
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 192 deletions.
1 change: 1 addition & 0 deletions hn.md
@@ -0,0 +1 @@
# HackerNews
16 changes: 5 additions & 11 deletions index.html
Expand Up @@ -24,19 +24,19 @@

<!-- Schema.org for Google -->
<meta itemprop="name" content="Tick">
<meta itemprop="description" content="Location based, fully anonymous chat app">
<meta itemprop="description" content="Chat via nearby persons. Instant, Secure, Anonymously. 🕶 ">
<meta name="image" itemprop="image" content="/static/check.png">

<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Tick">
<meta name="twitter:description" content="Location based, fully anonymous chat app">
<meta name="twitter:description" content="Chat via nearby persons. Instant, Secure, Anonymously. 🕶 ">
<meta name="twitter:site" content="@tickchat">
<meta name="twitter:creator" content="@tickchat">
<meta name="twitter:image" content="http://res.cloudinary.com/cagatayc/image/upload/v1502388094/tick.gif">

<!-- Open Graph general (Facebook, Pinterest & Google+) -->
<meta name="og:title" content="Tick">
<meta name="og:description" content="Location based, fully anonymous chat app">
<meta name="og:description" content="Chat via nearby persons. Instant, Secure, Anonymously. 🕶 ">
<meta name="og:image" content="/static/check.png">
<meta name="og:url" content="https://tick.chat">
<meta name="og:site_name" content="Tick">
Expand All @@ -57,13 +57,7 @@
enable: false /* Set to false to hide */
},
safari_web_id: 'web.onesignal.auto.3437296f-1581-4c9c-99a7-ef947df2b18c'

}]);
OneSignal.push(function() {
OneSignal.getUserId(function(userId) {
console.log("User ID:", userId);
});
});
</script>

<!--[if IE]><link rel="shortcut icon" href="/static/favicons/favicon-32x32.png"><![endif]-->
Expand All @@ -77,7 +71,7 @@
</head>
<body>
<noscript>
Tick doesn't run their code in your browser.
Tick.Chat doesn't run their code in your browser.
</noscript>
<div id="app"></div>
<!-- Todo: only include in production -->
Expand Down
1 change: 1 addition & 0 deletions ph.md
@@ -0,0 +1 @@
# ProductHunt
1 change: 0 additions & 1 deletion server/index.js
Expand Up @@ -63,4 +63,3 @@ io.on('connection', (socket) => {
});

io.listen(process.env.PORT || 3000);

108 changes: 68 additions & 40 deletions src/app.vue
Expand Up @@ -6,38 +6,37 @@
<f7-page name="map">
<g-map></g-map>
<f7-toolbar tabbar v-if="isSocketConnected">
<f7-link icon="icon fa fa-podcast fa-2x" open-popup="#popup"></f7-link>
<f7-link icon="icon fa fa-inbox fa-2x" href="/inbox/"></f7-link>
<!-- <f7-link icon="icon fa fa-podcast fa-2x" open-popup="#popup"></f7-link> -->
<f7-link icon="icon fa fa-bolt fa-2x" href="/inbox/"></f7-link>
</f7-toolbar>
</f7-page>
</f7-pages>
</f7-view>
</f7-views>

<f7-popup id="popup">
<f7-view navbar-fixed layout="dark" :theme="theme">
<f7-panel right reveal layout="dark" :theme="theme">
<f7-view id="right-panel-view" navbar-through :dynamic-navbar="true">
<f7-navbar title="Publications" sliding></f7-navbar>
<f7-pages>
<f7-page>
<f7-navbar>
<f7-nav-center>
Status & Settings
</f7-nav-center>
<f7-nav-right>
<f7-link close-popup>Close</f7-link>
</f7-nav-right>
</f7-navbar>
<f7-block-title>Announcement</f7-block-title>

<f7-block><h2>Share your ideas whole world!</h2></f7-block>
<f7-block>Announce idea, ask a question, feel free be polite.</f7-block>

<f7-block>
<f7-list form>
<f7-list-item>
<f7-input @input="ideas" type="textarea" :placeholder="user.data || 'Ideas spreads the world!'"></f7-input>
<f7-input v-model="user.data" @input="ideas" type="textarea" :placeholder="user.data || getRandom()"></f7-input>
</f7-list-item>
<f7-list-item>
<f7-button @click="spread" color="green" style="width: 100%;" no-link-class close-panel :disabled="isDisabled"><span class="icon fa fa-paper-plane faa-pulse animated-hover"></span></f7-button>
</f7-list-item>
</f7-list>


</f7-block>

<f7-block><h2>Publication settings</h2></f7-block>
<f7-block-title>Settings</f7-block-title>

<f7-block>
<f7-list form>
Expand All @@ -48,30 +47,50 @@
<f7-input type="text" :value="user.username" placeholder="username" disabled/>
</f7-list-item>
<f7-list-item>
<f7-label>Theme</f7-label>
<f7-input type="select" @change="onChange('theme', $event)">
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="pink">Pink</option>
<option value="gray">Gray</option>
</f7-input>
</f7-list-item>
<f7-list-item>
<f7-label>Location blur?</f7-label>
<f7-label>Blur? <i>*</i></f7-label>
<f7-input type="switch" @change="onChange('blur', $event)" :checked="locationBlur"></f7-input>
</f7-list-item>
<f7-list-item>
<!-- <f7-list-item>
<f7-label>Send via enter?</f7-label>
<f7-input type="switch" @change="onChange('sendWithEnter', $event)" :checked="sendWithEnter"></f7-input>
</f7-list-item>
</f7-list-item> -->
</f7-list>
</f7-block>

<f7-block-title>FAQ</f7-block-title>

<f7-block>
<f7-accordion>
<!-- Item 1 -->
<f7-accordion-item>
<f7-accordion-toggle>What is blur</f7-accordion-toggle>
<f7-accordion-content>
<p>Tick, by default, share your location in privacy. Your exact location is <i>blurred</i>.</p>
<p>If you <b>disable blur option, your current location will be published as exactly</b>.</p>
</f7-accordion-content>
</f7-accordion-item>
<!-- Item 2 -->
<f7-accordion-item>
<f7-accordion-toggle>Privacy</f7-accordion-toggle>
<f7-accordion-content>
<p>* Only the necessary logs and debug information are kept</p>
<p>* Developed features are made available under a Free Software license</p>
<p>* Tick.chat can block your access any time for any reason</p>
<p>* Changes can happen any time, sometimes without notice</p>
<p>* The app, can share your current location with other parties in real time.</p>
</f7-accordion-content>
</f7-accordion-item>
</f7-accordion>
</f7-block>

<f7-block>
<f7-link href="https://github.com/cagataycali/tick.chat" external>Tick.chat is open-source, contributions are welcome! <span class="icon fa fa-github faa-pulse animated"></span></f7-link>
</f7-block>

</f7-page>
</f7-pages>
</f7-view>
</f7-popup>

</f7-panel>
</div>
</template>

Expand All @@ -89,17 +108,26 @@ export default {
'sendWithEnter'
])
},
data() {
return {
isDisabled: true
};
},
methods: {
ideas: _.debounce(function (value) {
this.user.data = value;
let me = this.$store.state.users.find(user => user.id === this.$store.state.user.id);
me.data = value;
this.spread(me)
}, 3000),
spread: _.debounce(function (me) {
let {id, data, username} = me;
this.$socket.emit('spread', {id, data, username});
}, 50),
getRandom: function() {
let messages = ['happiness must spread to the world.', 'ask a quick solution of making money!', 'ask for help!', 'discuss your idea'];
return messages[Math.floor(Math.random()*messages.length)];
},
ideas: function (value) {
this.isDisabled = false;
},
spread: function () {
// let me = this.$store.state.users.find(user => user.id === this.$store.state.user.id);
let me = this.$store.state.user;
me.data = this.user.data; // This for map info box.
this.$socket.emit('spread', me);
this.isDisabled = true;
},
onChange: function(type, event) {
let input = event.target;
if (type === 'theme') {
Expand All @@ -118,7 +146,7 @@ export default {
Splash
},
created() {
window.f7 = this.$f7
// window.f7 = this.$f7
window.addEventListener('beforeinstallprompt', function(e) {
e.preventDefault();
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat.vue
Expand Up @@ -53,6 +53,7 @@
};
this.$store.dispatch('sendMessage', message);
message.to = this.$store.state.currentConversation.id
message.isTrend = false
this.$socket.emit('message', message)
clear();
},
Expand Down Expand Up @@ -86,7 +87,6 @@
} finally {
console.log('Chat created');
}
}
}
</script>
Expand Down
100 changes: 100 additions & 0 deletions src/components/GroupChat.vue
@@ -0,0 +1,100 @@
<template>
<f7-page navbar-fixed name="groupChat">
<f7-navbar :title="conversationtTitle" back-link="Back" sliding></f7-navbar>
<f7-messages scrollMessagesOnlyOnEdge class="chats">
<f7-message v-for="message in messages"
:key="message.id"
:text="message.text"
:label="message.label"
:date="message.date"
:name="message.name"
:avatar="getAvatar(message)"
:type="message.type"
:username="message.name"
:day="message.day"
:time="message.time"
></f7-message>
</f7-messages>
<f7-messagebar placeholder="Say something.." @input="keyPress" @submit="onSubmit">
<span slot="send-link"><i style="font-size:1.8em;" class="fa fa-paper-plane fa-2x"></i></span>
</f7-messagebar>
</f7-page>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
data() {
return {
messages: []
}
},
props: ['id'],
methods: {
keyPress: function(event) {
if (this.sendWithEnter) {
if (event.split('\n').length > 1) {
this.onSubmit(event.split('\n')[0], this.$f7.messagebar('.messagebar').clear)
}
}
},
onSubmit: function(text, clear) {
if (text.trim().length === 0) return;
let message = {
id: this.$store.state.user.id,
name: this.$store.state.user.username,
avatar: `https://api.adorable.io/avatars/60/${this.$store.state.user.username}`,
text: text,
date: (function () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
return hours + ':' + minutes;
})()
};
this.$store.dispatch('sendMessage', message);
message.to = this.$store.state.currentConversation.id
message.country = this.$store.state.currentConversation.country
message.isTrend = true
this.$socket.emit('message', message)
clear();
},
getAvatar(message) {
return `https://api.adorable.io/avatars/60/${message.name}`;
}
},
computed: {
...mapGetters([
'conversation',
'conversationtTitle',
'sendWithEnter',
])
},
created() {
try {
this.$store.dispatch('currentConversation', this.id);
this.messages = this.$store.state.currentConversation.messages
} catch (e) {
console.log(e);
} finally {
console.log('Chat created');
}
}
}
</script>

<style media="screen">
.chats {
padding-bottom: 40px;
}
.messages-content {
background: #EEEEEE;
}
.message-sent .message-text {
background-color: #00ADB5;
}
.message-received .message-text {
background-color: #393E46;
color: #EEEEEE;
}
</style>

0 comments on commit a503778

Please sign in to comment.