I thought that Bahaullah claimed that the Bab was the Imam Mahdi and that he himself was Jesus.
You are saying Bahaullah was the Mahdi as well as Jesus as well as all the 'manifestations'? So who was Bab?
As I recall, it was the Bab who claimed to be the Mahdi. Baha'u'llah never claimed to be the Mahdi or Jesus.
Baha'u'llah was the return of all the Manifestations, the same the divine appearance and heavenly splendor, the same Holy Spirit, but in His human station He was distinct from the other Manifestations of God.
Regarding His relationship to Jesus, the following is what Baha'u'llah claimed. He claimed to be the return of the Spirit of God and He claimed to be the Spirit of Truth (who was also the Comforter) that Jesus promised to send from the Father in the Gospel of John:
“O kings of Christendom! Heard ye not the saying of Jesus, the Spirit of God, “I go away, and come again unto you”? Wherefore, then, did ye fail, when He did come again unto you in the clouds of heaven, to draw nigh unto Him, that ye might behold His face, and be of them that attained His Presence? In another passage He saith: “When He, the Spirit of Truth, is come, He will guide you into all truth.”
Gleanings From the Writings of Bahá’u’lláh, p. 246
“We, in truth, have sent Him Whom We aided with the Holy Spirit (Jesus Christ) that He may announce unto you this Light that hath shone forth from the horizon of the will of your Lord, the Most Exalted, the All-Glorious, and Whose signs have been revealed in the West. Set your faces towards Him (Bahá’u’lláh) on this Day which God hath exalted above all other days, and whereon the All-Merciful hath shed the splendour of His effulgent glory upon all who are in heaven and all who are on earth.”
Proclamation of Bahá’u’lláh, p. 18
“Ye make mention of Me, and know Me not. Ye call upon Me, and are heedless of My Revelation…. O people of the Gospel! They who were not in the Kingdom have now entered it, whilst We behold you, in this day, tarrying at the gate. Rend the veils asunder by the power of your Lord, the Almighty, the All-Bounteous, and enter, then, in My name My Kingdom. Thus biddeth you He Who desireth for you everlasting life…”
Proclamation of Bahá’u’lláh, p. 91
“The Word which the Son concealed is made manifest. It hath been sent down in the form of the human temple in this day. Blessed be the Lord Who is the Father! He, verily, is come unto the nations in His most great majesty.”
Proclamation of Bahá’u’lláh, p. 84-85
“This is, truly, that which the Spirit of God (Jesus Christ) hath announced, when He came with truth unto you, He with Whom the Jewish doctors disputed, till at last they perpetrated what hath made the Holy Spirit to lament, and the tears of them that have near access to God to flow….”
Proclamation of Bahá’u’lláh, p. 19
“WE, verily, have come for your sakes, and have borne the misfortunes of the world for your salvation. Flee ye the One Who hath sacrificed His life that ye may be quickened? Fear God, O followers of the Spirit (Jesus), and walk not in the footsteps of every divine that hath gone far astray… Open the doors of your hearts. He Who is the Spirit (Jesus) verily, standeth before them.”
Proclamation of Bahá’u’lláh, p, 92
Please note that in the last passage where Baha'u'llah says "“WE, verily, have come for your sakes..." He was referring to Himself and Jesus.