 							Dom.onTap !->
 								Page.nav !->
 									renderPhoto msg, num
-
 					else if photoKey is ''
 						Dom.div !->
 							Dom.cls 'chat-nophoto'

	contactUserId = 3-myUserId

exports.render = !->
	log 'render'
	
	Dom.style
		fontSize: '90%'

	Chat.renderMessages
		newCount: Obs.peek -> Event.getUnread() || 0
		content: (msg, num) !->
			return if !msg.isHash()
			byUserId = msg.get('by')
			name = Plugin.userName byUserId

							Dom.text tr("sending")
							Ui.dots()

					if !photoUpload
						Dom.onTap !->
							msgModal msg, num

	Obs.observe !->
		Photo.uploads.iterate (newPhoto) !-> # Previews of image uploads
			Page.scroll 'down', true # Scroll to the preview of the image that is getting uploaded
			preview = Obs.create newPhoto.get()
			preview.set "photoUpload", true
			preview.set "by", Plugin.userId()
			messageContent(preview)

	typingSub = Obs.create {}
	Server.send 'typingSub', (delta) !-> typingSub.patch delta
	Dom.div !->
		wasNearBottom = Page.nearBottom()
		users = (Plugin.userName(userId) for userId of typingSub.get() when +userId isnt myUserId)

		Dom.style
			fontSize: '80%'
			padding: '4px 0'
